function validate(evt) {
var theEvent = evt || window.event;
var key = theEvent.keyCode || theEvent.which;
key = String.fromCharCode( key );
var regex = /[0-9]|\./;
if( !regex.test(key) ) {
// alert('hello')
theEvent.returnValue = false;
if(theEvent.preventDefault) theEvent.preventDefault();
}
}
Last active
August 29, 2015 14:03
-
-
Save sgsheg/218fa339c0ea53a56e24 to your computer and use it in GitHub Desktop.
input only numberic
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment