jQuery set var where n is ID for tabindex order?
jQuery set var where n is ID for tabindex order?
HTML
Name:<input type="text" id="input_1" /><br />
<input type="hidden" /><br />
<input type="hidden" /><br />
Age:
<input type="text" id="input_3" /><br />
Birth:
<input type="text" /><br />
Test:<select>
<option>a</option>
<option>b</option>
</select><br />
Gender:
<input type="radio" name="gender" />
Male
<input type="radio" name="gender" />Female
<br />
Vechical:
<input type="checkbox" name="Vechical" /><br />
<input type="checkbox" name="Vechical" /><br />
<input type="checkbox" name="Vechical" /><br />
<input type="hidden" />
test1:
<input type="text" id="input_7" /><br />
test2:
<input type="text" /><br />
test3:
<input type="text" /><br />
test4:
<input type="text" /><br />
JavaScript
$(document).ready(function () {
var tab_order_positions = ['1', '7', '3']
var tabindex = tab_order_positions.length;
$.each(tab_order_positions, function (i, tab_order_position) {
//$('#input_' + tab_order_position).attr('tabindex', i);
});
$('input, select').each(function (i) {
var obj = $(this);
if (obj.attr('type') != 'hidden' && (obj.attr('id') !== undefined && $.inArray(obj.attr('id').split('_')[1], tab_order_positions)) === false) {
// obj.attr('tabindex', tabindex);
tabindex++;
}
});
});