Brad Walls Brad Walls - 1 year ago 79
jQuery Question

on tab hit show/hide

I have a script that shows a div onclick, however I want the same logic to occur when the user hits the tab button.


Can this function be used for a tab button? If so, how?

Answer Source

If you want to detect tab key from password field. You can try this:

$("#password").keydown(function (e) { 
  var keyCode = e.keyCode || e.which; 

  if (keyCode == 9) { 
    $("#password").trigger("click"); // trigger click event