Possible Duplicate:
HTML Text Input allow only Numeric input
I used this script
function isNumberKey(evt)
{
var e = event || evt; // for trans-browser compatibility
var charCode = e.which || e.keyCode;
if (charCode > 31 && (charCode < 47 || charCode > 57))
return false;
if (e.shiftKey) return false;
return true;
}
But this script not working in firefox alone.
Any alternatives to restrict user for shift key in javascript?
eventis not defined in Firefox, it’s breaking your code. Put it after testing forevt:Fiddle
Check your error console next time. 🙂