JSFiddle - React, Tailwind, and code Playground
by Tilwin Joy
HTML
<div id="container"></div>
CSS
div{
width:100px;
height:50px;
border:1px solid;
}
JavaScript
$("#container").click(function () {
console.log("click");
$(this).html("<input type='text' onkeypress='return isNumber(event)' onclick='event.stopPropagation();' style='width:35px;' value='" + $(this).text() + "' />");});
function isNumber(evt) {
console.log("call");
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode > 31 && (charCode < 48 || charCode > 57)) {
return false;
}
return true;
}