Reputation: 3223
How can I simulate a backtab in a js/jquery function?
I have a select2 function (Version: 3.4.6) with multiple selection, and it skips to to next field when I make a selection.
I have tried things like
$("[name=" + i + "]").select2('open');
and it doesn't work.
If I press a backtab the function does what I need. How do I simulate that?
Upvotes: 0
Views: 68
Reputation: 4981
var myEvent = jQuery.Event("keydown", { keyCode: 9 });
$("#myElement").trigger( myEvent );
Upvotes: 1