JSFiddle - React, Tailwind, and code Playground
by Suresh Pattu
HTML
<input class='clicker' type='text' value='clickme'><br>
<input class='clicker' type='text' value='me 2!'><br>
<input class='clicker' type='text' value='dont forget me!'><br>
JavaScript
$(document).delegate('input[type="text"]','click', function() {
$(this).replaceWith('<input type="password" value="'+this.value+'" id="'+this.id+'">');
});
$(document).delegate('input[type="password"]','click', function() {
$(this).replaceWith('<input type="text" value="'+this.value+'" id="'+this.id+'">');
});