I used this number format jQuery
for displaying numbers with commas while typing. But when i typed letters also in the box, it's also taking as input. I need it to accept only numbers in and not letters, what to do?
I used this number format jQuery
for displaying numbers with commas while typing. But when i typed letters also in the box, it's also taking as input. I need it to accept only numbers in and not letters, what to do?
I suppose this could be considered dirty, but instead of having to update the plugin yourself, just filter the keys first:
$('#bla').on('keypress', function(evt) { var code = evt.which || evt.keyCode;
if (code < 57 || code > 127) {
return;
}
evt.preventDefault();
}).number(true, 2);
function isNumeric(n) { return !isNaN(parseFloat(n)) && isFinite(n); }
use this function to check each input
refer this post to restrict text box to numeric only
Or else you can write your own regular expression on keyup event and validate the input.
Happy coding