In my project, I have a text box where I need to accept values less than or equal to 100. In this text box, how can I achieve this through javascript or jquery. Somehow I managed to accept only the numbers in the text box, but how can I limit it, not to accept numbers greater than 100.
Here is the code that I tried to accept only numbers
function isNumber(evt) {
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode > 31 && (charCode < 48 || charCode > 57)) {
return false;
}
return true;
}
source
share