I've seen thejQElement.toggle(fn1, fn2, fn3, fn4) would do the trick in case I wanted to click the element. I want it to sequencially fire the events on the tab keydown event.
Thanks
I've seen thejQElement.toggle(fn1, fn2, fn3, fn4) would do the trick in case I wanted to click the element. I want it to sequencially fire the events on the tab keydown event.
Thanks
You trigger .toggle()
by triggering a click
event, so just trigger that in a keydown
event, like this:
jQElement.keydown(function(e) {
var keyCode = e.keyCode || e.which;
if (keyCode == 9) $(this).click(); //tab key only
});
Alternatively, just use this same keyCode
check and write your own .tabToggle()
function, it wouldn't be difficult if you look at the source for .toggle()
.
You can view a quick .tabToggle()
demo here, adjust if needed, but the concept's the same as .toggle()
already does internally.