Disabling tab focus on form elements

后端 未结 7 1372
死守一世寂寞
死守一世寂寞 2020-12-04 15:00

I have several divs within the same form. What I am trying to do is to disable the Tab key in one of the divs in the form without disabl

相关标签:
7条回答
  • 2020-12-04 16:04

    If you're dealing with an input element, I found it useful to set the pointer focus to back itself.

    $('input').on('keydown', function(e) { 
        if (e.keyCode == 9) {
            $(this).focus();
           e.preventDefault();
        }
    });
    
    0 讨论(0)
提交回复
热议问题