How to add number Validation on textbox in JS –
In this example, Number validation in Javascript “onkeypress” event to accept Number only.

- The onkeypress=”return onlyNumberAccept(event,this);” function called in text box on onkeypress event.
- No need for any jQuery library.
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function onlyNumberAccept(e, t) {
try {
if (window.event) { var charCode = window.event.keyCode; }
else if (e) { var charCode = e.which; }
else { return true; }
if ((charCode < 65 || charCode > 90) && (charCode < 97 || charCode > 123) && charCode != 32 && charCode != 8 && charCode != 46) {
return false;
}
return true;
}
catch (err) { alert(err.Description); }
}
</script>
</head>
<body>
Mobile No. : <input type="text" maxlength="10" name="mobile_no" id="mobile_no" onkeypress="return onlyNumberAccept(event,this);">
</body>
</html>
More validations … Click here …
Number Validation on textbox in JS onkeypress
Hi there! Do you know if they make any plugins to help with Search Engine Optimization?
I’m trying to get my blog to rank for some targeted keywords
but I’m not seeing very good results. If you
know of any please share. Kudos! You can read similar art here:
Eco product