<script type='text/javascript'>
function isNumeric(elem, helperMsg){
var numericExpression = /^[0-9]+$/;
if(elem.value.match(numericExpression)){
return true;
}else{
alert(helperMsg);
elem.focus();
return false;
}
}
</script>
<form>
Enter Phone No : <input type='text' id='numbers'/>
<input type='button'
onclick="isNumeric(document.getElementById('numbers'), 'Numbers Only Please')"
value='Check Field' />
</form>
Showing posts with label Java script Number vvalidation. Show all posts
Showing posts with label Java script Number vvalidation. Show all posts
Tuesday, September 1, 2009
How to check the field is Numeric or Not ?
The small example shows the validation for the field is numeric or not:
Subscribe to:
Posts (Atom)