WRAP TEXT - WORKING
by bizamajig
HTML
<div>Testing before
<p>Some more text inside p</p>
between
<p>asdasdasdasdasde p</p>
Test after
</div>
JavaScript
var x = $('div').contents().filter( function(){ return this.nodeType === 3 } ).wrap( '<div />' ).wrap('<b />');
console.log(x);