I need to get the last 'tabindex' of a form when the user clicks 'tab' or 'enter' back to the first one.
Follow the current code:
$(':input').keydown( function(event) {
if ( (event.which === 13 || event.which === 9) && !event.shiftKey ) {
node = $(this);
currentIndex = node.attr('tabindex');
// if ( currentIndex > 0 ) {
if ( currentIndex > 0 && currentIndex < **MAX_TABINDEX** )
event.preventDefault();
currentIndex++;
$('[tabindex=' + currentIndex + ']').focus();
$('[tabindex=' + currentIndex + ']').select();
} else {
$('[tabindex=1]').focus();
$('[tabindex=1]').select();
}
}
Any ideas?