How do I disable backspace keystroke if anything other than 2 specific input fields are focused on using jquery?
here is my current code (NOW INCLUDING 2 TEXTBOXES):
Hudson-Peralta's answer worked good for me but I did a small modification since I use many keydown events:
$(document).keydown(function(e){ var elid = $(document.activeElement).is("input:focus"); if(e.keyCode === 8 && !elid){ e.preventDefault(); }; });