149
rated 0 times
[
150]
[
1]
/ answers: 1 / hits: 24190
/ 13 Years ago, fri, july 22, 2011, 12:00:00
I have the following code that assigns tabindex to my form id register1. I would like to place the cursor on the first input or select list item on the form (item with tabindex = 1) once tabindexes are assigned. but the following line: $('#register1').find('input').attr('tabindex',1).select();
Resets tabindex of all the inputs.
Full code:
$(function(){
var tabindex = 1;
$('#register1').find('input,select').each(function() {
if (this.type != hidden) {
var $input = $(this);
$input.attr(tabindex, tabindex);
tabindex++;
}
});
$('#register1').find('input').attr('tabindex',1).select();
});
thanks
More From » jquery