JSFiddle - React, Tailwind, and code Playground

by Palpatim

HTML

<span id="field">This is the text</span>

<button>Edit</button>

JavaScript

$('button').click(function () {
    var $f = $('#field');
    $f.attr('contenteditable', true);
    $f.focus();
});

$('#field').blur(function() {
    $(this).attr('contenteditable', false);
});