Reputation: 316
I have a set of divs
containing different styles within a div
. I want all those which match a certain class to be wrapped in a parent div
programmatically. How can we implement this? Any ideas?
Upvotes: 1
Views: 63
Reputation: 1131
Good ol' jQuery (haters gonna hate):
$("<p>").wrap("<div></div>");
Upvotes: 1
Reputation: 7878
There is a function .wrap()
or .wrapAll()
for that in jQuery:
$( ".class" ).wrap( "<div class='parent'></div>" );
If you could post some code, at least you html, I would be easier to find an answer wich fits your needs.
Upvotes: 1