使用jquery或javascript,我怎样才能找到DOM中有一个特定的tabindex设置它的输入元素,例如。找到基于tabindex的元素
<input id="txtInput" type="text" maxlength="5" tabindex="7">
我想这个元素返回,如果我正在寻找具有tabIndex元素= 7
使用jquery或javascript,我怎样才能找到DOM中有一个特定的tabindex设置它的输入元素,例如。找到基于tabindex的元素
<input id="txtInput" type="text" maxlength="5" tabindex="7">
我想这个元素返回,如果我正在寻找具有tabIndex元素= 7
你可以通过以下jQuery获得它
$('input[tabindex=7]')
$("[tabindex=7]") // all elements with tabindex=7
你可以找到一个属性选择元素:
$('[tabindex=7]')
这样会好得多,因为它只会得到'TabIndex = 7'的input元素 –