Javascript:- Functions to accept only numbers and only decimal value in textbox
Posted on January 27, 2017 by Santosh Shelar
Tagged:
Javascript
Posted on January 27, 2017 by Santosh Shelar
$('.number').keydown(function(e) {
if (e.shiftKey || e.ctrlKey || e.altKey) {
e.preventDefault();
} else {
var key = e.keyCode;
if (!((key == 8) || (key == 46) || (key >= 35 && key <= 40) || (key >= 48 && key <= 57) ||
(key >= 96 && key <= 105))) {
e.preventDefault();
}
}
});
|
No comments:
Post a Comment