I’m using jQuery 1.12. I have a couple of styled select menus on my page. When one is active, I would like to be able to press “Tab” and then have focus shift to the next styled select menu. I’m trying this
return $('div.select-styled:first').keydown(function(e) {
alert("key pressed");
if (e.which === 9) {
$('div.select-styled.active').each(function() {
return $(this).removeClass('active').next('ul.select-options').hide();
});
return $('div.select-styled:second').focus().click();
}
});
but nothing’s happening. You can see from my Fiddle — http://jsfiddle.net/cwzjL2uw/5/ , that you can click “Tab” on the last name field and the first styled select menu is activated, but then clicking “Tab” a second time does nothing. How do I capture the keypress event from my styled select menu?