<p>hello</p>
$("p").wrap("<div class='inner'></div>").wrap("<div class='outer'></div>");
The result is <div class="inner"><div class="outer"><p>hello</p></div></div>,
Why is it so? I expected inner inside outer, not otherwise.
Here is fiddle to play with : http://jsfiddle.net/qnYDY/
I think the first wrap call returns "p" itself , so when you wrap it again, the "outer" div will wrap the "p" tag and not any of its parents.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With