I have a div in which there is a certain number of IMG 21. What do I have to do, one around every 9 IMG Wrap the div. How can I get it?
My HTML structure:
& lt; Div id = "parent" & gt; & Lt; Img src = "#" & gt; & Lt; Img src = "#" & gt; & Lt; Img src = "#" & gt; & Lt; Img src = "#" & gt; & Lt; Img src = "#" & gt; & Lt; Img src = "#" & gt; & Lt; Img src = "#" & gt; & Lt; Img src = "#" & gt; & Lt; Img src = "#" & gt; & Lt; Img src = "#" & gt; & Lt; Img src = "#" & gt; & Lt; Img src = "#" & gt; & Lt; Img src = "#" & gt; & Lt; Img src = "#" & gt; & Lt; Img src = "#" & gt; & Lt; / Div & gt; that should be created:
& lt; Div id = "parent" & gt; & Lt; Div & gt; & Lt; Img src = "#" & gt; & Lt; Img src = "#" & gt; & Lt; Img src = "#" & gt; & Lt; Img src = "#" & gt; & Lt; Img src = "#" & gt; & Lt; Img src = "#" & gt; & Lt; Img src = "#" & gt; & Lt; Img src = "#" & gt; & Lt; Img src = "#" & gt; & Lt; / Div & gt; & Lt; Div & gt; & Lt; Img src = "#" & gt; & Lt; Img src = "#" & gt; & Lt; Img src = "#" & gt; & Lt; Img src = "#" & gt; & Lt; Img src = "#" & gt; & Lt; Img src = "#" & gt; & Lt; / Div & gt; & Lt; / Div & gt; You can: var $ Img = $ ("# parent IMG"); (Var i = 0; i & lt; $ img.length; i + = 9) {$ img.slice (i, i + 9). WrapAll ("& lt; div / & gt;"); }
No comments:
Post a Comment