I have a div with a generated title dynamic title
<div class="title">dynamic content</div>
and i would like to transform it like so:
<h2 class="title"><span>dynamic content</span></h2>
Would that be doable in jQuery?
This should do it.
$('div.title').replaceWith(function() {
return $('<h2>').addClass('title').append($('<span>').text($(this).text()));
});
http://jsfiddle.net/uPFUu/
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