find element based on tabindex

有些话、适合烂在心里 提交于 2019-12-10 01:24:14

问题


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.


回答1:


You can get it with the following jQuery

$('input[tabindex=7]')



回答2:


You can find the element by an attribute selector:

$('[tabindex=7]')



回答3:


With the attribute selector:

$("[tabindex=7]") // all elements with tabindex=7


来源:https://stackoverflow.com/questions/6872386/find-element-based-on-tabindex

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!