Reputation: 3802
I have below format text in my file.
<p>
hi
<span class="start"></span>
inside span
<span class="start"></span>
</p>
How do I convert it into Like this
<p>
hi
<span class="start"></span>
<span class="wrap">inside span</span>
<span class="start"></span>
</p>
Edit:
What I am trying to do is
$('.start').next().contents().wrap('<span class="wrap"/>');
But it is not Working well.
Upvotes: 1
Views: 76
Reputation: 586
DOM elements has a property nextSibling, which includes text nodes and which JQuery will be able to identify.
$($('.start')[0].nextSibling).wrap('<span class="wrap"></span>');
Upvotes: 2