JSFiddle - React, Tailwind, and code Playground

HTML

<input class='clicker' type='button' value='clickme'><br>
<input class='clicker' type='button' value='me 2!'><br>
<input class='clicker' type='button' value='dont forget me!'><br>

JavaScript

$('.clicker').bind('click', function() {
    $(this).replaceWith('<input type="text" value="'+this.value+'" id="'+this.id+'">');
});