JSFiddle - React, Tailwind, and code Playground
by vivek sharma
HTML
<input type="text"/>
JavaScript
$(document).ready(function () {
$('input').keyup(function() {
var $th = $(this);
$th.val( $th.val().match(/^(\d+)?([.]?\d{0,2})?$/g,
function(str) {
//alert('You typed " ' + str + ' ".\n\nPlease use only numbers.');
return ''; }
) );
});
});