Thursday, 15 March 2012

wrapper - How to wrap 1-2 or more of the same class using JQuery but not getting to wrap it with a different class in between? -


To make me visually sensible, I would like it to:

  & lt; Div class = "wrap" & gt; & Lt; Input type = "hidden" /> & Lt; Input type = "hidden" /> & Lt; Div class = "a" & gt; Content & lt; / Div & gt; & Lt; Input type = "hidden" /> & Lt; Input type = "hidden" /> & Lt; Input type = "hidden" /> & Lt; Div class = "a" & gt; & Lt; / Div & gt; & Lt; Input type = "hidden" /> & Lt; Div class = "a" & gt; & Lt; / Div & gt; & Lt; Input type = "hidden" /> & Lt; Input type = "hidden" /> & Lt; Div class = "bee" & gt; & Lt; / Div & gt; & Lt; Input type = "hidden" /> & Lt; Input type = "hidden" /> & Lt; Div class = "a" & gt; & Lt; / Div & gt; & Lt; Input type = "hidden" /> & Lt; Input type = "hidden" /> & Lt; Div class = "cee" & gt; & Lt; / Div & gt; & Lt; Input type = "hidden" /> & Lt; Input type = "hidden" /> & Lt; Input type = "hidden" /> & Lt; Div class = "a" & gt; & Lt; / Div & gt; & Lt; Input type = "hidden" /> & Lt; Input type = "hidden" /> & Lt; Input type = "hidden" /> & Lt; Input type = "hidden" /> & Lt; Div class = "a" & gt; & Lt; / Div & gt; & Lt; / Div & gt;  

To become:

  & lt; Div class = "wrap" & gt; & Lt; Div class = "jquerywrap" & gt; & Lt; Input type = "hidden" /> & Lt; Input type = "hidden" /> & Lt; Div class = "a" & gt; Content & lt; / Div & gt; & Lt; Input type = "hidden" /> & Lt; Input type = "hidden" /> & Lt; Input type = "hidden" /> & Lt; Div class = "a" & gt; & Lt; / Div & gt; & Lt; Input type = "hidden" /> & Lt; Div class = "a" & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Input type = "hidden" /> & Lt; Input type = "hidden" /> & Lt; Div class = "bee" & gt; & Lt; / Div & gt; & Lt; Div class = "jquerywrap" & gt; & Lt; Input type = "hidden" /> & Lt; Input type = "hidden" /> & Lt; Div class = "a" & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Input type = "hidden" /> & Lt; Input type = "hidden" /> & Lt; Div class = "cee" & gt; & Lt; / Div & gt; & Lt; Div class = "jquerywrap" & gt; & Lt; Input type = "hidden" /> & Lt; Input type = "hidden" /> & Lt; Input type = "hidden" /> & Lt; Div class = "a" & gt; & Lt; / Div & gt; & Lt; Input type = "hidden" /> & Lt; Input type = "hidden" /> & Lt; Input type = "hidden" /> & Lt; Input type = "hidden" /> & Lt; Div class = "a" & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt;  

HTML is generated automatically inside the wrap so I have to walk on the path of JQuery.

Edit: I want to let you know that always 1 or more hidden type input on all siblings in a "Screw" category

All of you .a elements whose previous brochures have a .a element I.e. the beginning of each block), then all its notations (code) .a like all siblings and call wrap (

  $ ('.wrap' .a '). No ('.a + .a'). WrapAll ('& quot; div class = "JQueryWrap" /> & gt;'}})   / Pre> 

Demo:


No comments:

Post a Comment