I need to find all the p tags inside all the divs with a class of someClass and wrap them with another div. This is how the beginning mark up would look like :
<div class="someClass">
// Lots of different tags generated by the site
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
</div>
<div class="someClass">
// Lots of different tags generated by the site
<p>Some text</p>
<p>Some text</p>
</div>
Would turn into :
<div class="someClass">
// Lots of different tags generated by the site
<div class="bla">
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
</div>
</div>
<div class="someClass">
// Lots of different tags generated by the site
<div class="bla">
<p>Some text</p>
<p>Some text</p>
</div>
</div>
Any ideas? When I try using .each() : for each div with a class of someClass wrap all the p tags, but it just wraps them all together in the top div. I've tried many other things without success. thanks for having a look!