Search code examples
javascripthtmlcsshiddentranslate

Tab key jumping to hidden form


The blocks are at a different distance, my script switches them via transform: translate. But when you go through the fields through the tab button, he switches them to the same incorrect. How to prevent it when you click on the tab to move to the hidden div? display: none. Don't to offer. :) Example on jsfiddle: https://jsfiddle.net/6c3xsj8q/5/


Solution

  • You can do it by javascript,

    Disable tab press on submit button of first form

    like this

    $('#first button[type=submit]').keydown(function(objEvent) {
     if (objEvent.keyCode == 9) {  //tab pressed
        objEvent.preventDefault(); // stops its action
     }
    })