JSFiddle - React, Tailwind, and code Playground
by ipr101
HTML
<p>
Once upon a time there was a man
who lived in a pizza parlor. This
man just loved pizza and ate it all
the time. He went on to be the
happiest man in the world. The end.
</p>
JavaScript
var words = $("p:first").text().split(" ");
var text = words.join("</span> <span>");
$("p:first").html("<span>" + text + "</span>");
$("span").click(function() {
$("span input[class=tb]").each(function () {$(this).parent('span').html($(this).val())});
$(this).html('<input class="tb" value="'+$(this).text() +'"/>');
$(this).unbind("click");
});