0

So what I need is, e.g I have a button, when it gets clicked, I wish it also to trigger a tab key press, so the focus will move to next element with tabindex=0

I have something like this, but not working:

var btnSkipMenu = $("#btnSkipMenu");
btnSkipMenu.click(function() {            
        var tabEvent = jQuery.Event("keydown");
        tabEvent.which = 9;
        this.trigger(tabEvent);  //so it should simulate key press tab, then focus move to next tabindex=0
    });

please advise with some code sample Thanks

sefirosu
  • 2,558
  • 7
  • 44
  • 69
  • Please post a [mcve] of your attempt, noting input and expected output using the [\[<>\]](https://meta.stackoverflow.com/questions/358992/ive-been-told-to-create-a-runnable-example-with-stack-snippets-how-do-i-do) snippet editor. – mplungjan May 18 '22 at 12:32
  • https://stackoverflow.com/questions/7303507/simulating-the-tab-keydown-focusing-next-element-as-determined-by-tabindex – epascarello May 18 '22 at 12:35

0 Answers0