Here is my JS
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) ) {
theEvent.returnValue = false;
if(theEvent.preventDefault) theEvent.preventDefault();
}
}
the script is for the input
tag only can type number only.
It works well on google chrome, but on firefox 15.0 backspace, delete, arrow key is not working
This is bug of firefox, or something wrong with my script?