How to disable backspace if anything other than input field is focused on using jquery

后端 未结 9 1034
南笙
南笙 2021-02-06 05:03

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):

9条回答
  •  情话喂你
    2021-02-06 05:10

    I think a slight modification is needed to handle textareas:

    var elid = $(document.activeElement).is("input:focus, textarea:focus"); 
    

提交回复
热议问题