I have this <p>
tag
<p class='form-control' data-color='inherit' data-width='12' data-type='sh_info' name='shortcode[]' data-style=''>Some dynamic text</p>
and I want, on click
to replace it with a textarea
tag, but I want all my data and classes to persist. I fount this function in jquery
$( "p.form-control" ).click(function() {
$( this ).replaceWith( "<textarea>" + $( this ).text() + "</textarea>" );
});
but I was wondering is there a function that allows you to substitute just the tag with something else?