I'm not sure if this is even possible but here goes. I have a site that I am creating which will house some JQuery tabs, the user wants to be able to navigate between those tabs using the keyboard as they will be entering lots of data. Is it possible to set up custom short cuts to switch between the tabs?
Asked
Active
Viewed 130 times
-3
-
7Yes, [it's possible](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent). – canon Oct 11 '13 at 15:07
-
No offense but with 1457 reputation points, one should know that this kind of thread will be down voted `:/` – Stphane Oct 11 '13 at 15:15
2 Answers
1
You can also use jQuery to check which key was pressed:
$('.selector').on('keypress', function(e) {
var code = e.keyCode || e.which;
if(code == 13) { //Enter keycode
//Do something
}
});

damian
- 5,314
- 5
- 34
- 63
1
Sure (I think this work with tabs, but i'm not 100%):
$(window).keydown(function(event) {
if(event.ctrlKey && event.keyCode == SOMEKEYCODE) {
$( "#tabs" ).tabs( "option", "active", 0 );
}
else if(event.ctrlKey && event.keyCode == SOMEOTHERKEYCODE){
$( "#tabs" ).tabs( "option", "active", 1 );
}
});

Mister Epic
- 16,295
- 13
- 76
- 147