Text Field Number Validation Java Script
by Francis[ Edit ] 2012-11-27 17:46:52
Text Field Number Validation
In text field allowed to enter only numbers not for alphabets and symbols etc...
JS Syntax
string.replace(/[^\d\.]/g, '');
<html>
<head>
<script type="text/javascript">
function checnum(as)
{
var a = as.value;
as.value = a.replace(/[^\d\.]/g, '');
}
</script>
</head>
<body>
Number : <input type=text onkeyup=checnum(this)>
</body>
</html>