Reputation: 53
I have a question, I want to replace the following code
<h2> Heading 1</h2>
<h2> Heading 2</h2>
with the following code
<h2><span> Heading 1</span></h2>
<h2><span> Heading 2</span></h2>
I want to do that with jquery. Please help me...
Upvotes: 0
Views: 98
Reputation: 13461
You can do this using $.wrapInner
$('h2').wrapInner('<span/>')
Upvotes: 0
Reputation: 179046
Please take some time to review the jQuery api. wrapInner
will do the trick.
$('h2').wrapInner('<span>');
Upvotes: 2