JSFiddle - React, Tailwind, and code Playground

by mrobin

HTML

<p>Some Text</p>

JavaScript

$('p').dblclick(function(){
     var textArea = $('<textarea />')
     var oldText = $(this).text();
     $(this).replaceWith(textArea);
    textArea.blur(function(){
        var newValue = $(this).val();
        $(this).replaceWith($('<p>'+ newValue + '</p>'));
    });
     textArea.val(oldText);
});