I have to disable some symbols from html input.
e.which is not working properly on Firefox. Firefox disables backspace and ect.
Here is JS Fiddle:
var code = window.event ? event.keyCode : e.which;
event.keyCode works on firefox, but does not work with String.fromCharCode(code).
You've got two errors in your script:
eventbut referred toe.which.2. you have to callevt.preventDefault()for preventing the typed character to appear.The latter point is wrong when adding jQuery event handlers. 'Normal' DOM handlers require
preventDefault(), see also this comment.→ jsFiddle