How do I focus on the next element that has a ‘tabindex’ property
I need to this because all my inputs and selects have the same tabindex and do not have ids
$('form').keypress(function (event) {
$("*:focus").nextAll('[tabindex]').focus(); //this is not working
});
<div>
<input type="text" tabindex="1" />
<input " type="text" tabindex="1" />
<br /><br />
<input type="text" tabindex="1" />
<select tabindex="1">
<option value=""></option>
<option value=""></option>
<option value=""></option>
<option value=""></option>
<option value=""></option>
</select>
<input type="text" tabindex="1" />
</div>
You’ll need to select the
:firstelement:Notice also, you don’t need the
*at the start of the:focusselector. This is implied.There’s a full mockup here http://jsfiddle.net/QJQDP/1/
You’ve also got a typo (an extra
") in your second input.