I want to replace a p tag with a textbox using jQuery. What I have tried isn't working.
<p> Some text.. </p>
$('p').dblclick(function(){
var textArea = $('<textarea />')
var oldText = $(this).text();
$(this).replaceWith(textArea);
textArea.val(oldText);
});
See example here.
On focusout, you can read the new value (or old) and set it back within a p tag.
See that example here
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