The regular expression used to identify only the numbers is var regexp = /\D|\./.
<script>
function IdentifyNumbers()
{
var Number = document.getElementById('NumericValue').value;
var regexp = /\D|\./ ;
if(Number.match(regexp))
{
alert('Only enter numbers and no decimal point\nInvalid input: '+Number.match(regexp));
}
else
{
alert('Valid Input');
}
}
</script>
Share with