Anyone know how can I disable backspace and delete key with Javascript in IE? This is my code below, but seems it’s not work for IE but fine for Mozilla.
onkeydown='return isNumberKey(event,this)' function isNumberKey(evt, obj) { var charCode = (evt.which) ? evt.which : evt.keyCode if (charCode == 8 || charCode == 46) return false; return true; }
This event handler works in all the major browsers.
You can attach the event to this function like: