Reputation: 251
What I want is to wrap all my p
tags in a special div having a class p_wrapper. I want something like this:(For all elements not only for p
and div
)
$('p').wrappAll('.p_wrapper')
I should get this HTML:
<p>This is a paragraph!</p>
<p>This is another paragraph!</p>
<div class="p_wrapper"> <p>This is a paragraph!</p> </div>
<div class="p_wrapper"> <p>This is another paragraph!</p> </div>
Upvotes: 3
Views: 92
Reputation: 33870
This should work :
$('p').wrap('<div class="p_wrapper">');
Upvotes: 2