Skip to content Skip to sidebar Skip to footer

Enter Button Works As Tab

I just have button in a page and nothing else When I open the page and press tab it comes to button but instead I want it in such a way that if

Solution 1:

Check this!

$(function() {
  $(document).keydown(function(e) {
    if (e.keyCode == 13) {
      $("button#hel").focus();
    } elseif (e.keyCode == 9) {
      var e = jQuery.Event("keydown", {
        keyCode: 9
      });
      $(document).trigger(e);
    }
    returnfalse;
  });
});
<scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><buttonid="hel">hello</button><button>hello</button><button>hello</button>

Post a Comment for "Enter Button Works As Tab"