Skip to content Skip to sidebar Skip to footer

Wrap Some Divs With Two Different Columns

I've these divs
-115
-91
-99

Solution 1:

You should use class instead of id here and then you can use wrapAll

$('.content').each(function() {
  $(this).find(".lpost").wrapAll('<div class="left_columns"></div>')
  $(this).find(".rpost").wrapAll('<div class="right_columns"></div>')
})
<scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><divclass="content"><divclass="rpost">-115</div><divclass="lpost">-91</div><divclass="lpost">-99</div><divclass="rpost">-181</div><divclass="lpost">-19</div><divclass="rpost">-135</div><divclass="rpost">-85</div><divclass="lpost">-39</div></div>

Post a Comment for "Wrap Some Divs With Two Different Columns"