Why does this not work
I’m trying to focus on the next element in the next td with “tabindex” .
my elements dont have ids and all have the same tabindex
$('form').keypress(function (event) {
$(":focus").parents('td').next('td').find('[tabindex]:first').focus(); //this is not working
}
});
<table>
<tr>
<td><input name="TextBox1" type="text" tabindex="1" /></td>
<td><input name="TextBox2" type="text" tabindex="1" /></td>
</tr>
<tr>
<td><input name="TextBox3" type="text" tabindex="1" /></td>
<td><input name="TextBox5" type="text" tabindex="1" /></td>
</tr>
<tr>
<td>
<select name="DropDownList1" tabindex="1">
<option value=""></option>
<option value=""></option>
<option value=""></option>
<option value=""></option>
<option value=""></option>
</select>
</td>
<td><input name="TextBox6" type="text" tabindex="1" /></td></td>
</tr>
<tr>
<td><input name="TextBox7" type="text" tabindex="1" /></td></td>
<td><input name="TextBox8" type="text" tabindex="1" /></td></td>
</tr>
</table>
I modified your code in jsfiddle