I would like to replace div tags for p tags but only when the div tag does not have a class.
So this:
<div class="myDiv">
<div>sdfglkhj sdfgkhl sdfkhgl sdf</div>
<div>dsf osdfghjksdfg hsdfg</div>
</div>
Would become:
<div class="myDiv">
<p>sdfglkhj sdfgkhl sdfkhgl sdf</p>
<p>dsf osdfghjksdfg hsdfg</p>
</div>
I’ve tried .replace("<div>", "<p>").replace("</div>","</p>") but this replaces the closing tag of the one with a class.
This can easily be done with jQuery using the
:not()selector and.unwrap().wrap()http://jsfiddle.net/matthewbj/ujLHk/