find element based on tabindex

amateur picture amateur · Jul 29, 2011 · Viewed 21k times · Source

Using jquery or javascript, how can I find the input element in the DOM that has a particular tabindex set to it, eg.

<input id="txtInput" type="text" maxlength="5" tabindex="7">

I would want this element returned if I was searching for the element with tabindex = 7.

Answer

Nalum picture Nalum · Jul 29, 2011

You can get it with the following jQuery

$('input[tabindex=7]')