JSFiddle - React, Tailwind, and code Playground
HTML
<span class="loadNum">5566</span>
<br />
<span class="loadNum">5566</span>
JavaScript
var switchToInput = function () {
var $input = $("<input>", {
val: $(this).text(),
type: "text"
});
$input.addClass("loadNum");
$(this).replaceWith($input);
$input.on("blur", switchToSpan);
$input.select();
};
var switchToSpan = function () {
var $span = $("<span>", {
text: $(this).val()
});
$span.addClass("loadNum");
$(this).replaceWith($span);
$span.on("click", switchToInput);
}
$(".loadNum").on("click", switchToInput);