我正试图专注于 jquery 中的 anchor
我正在使用这些代码:
$(textBox).parent().next().find('a').first().focus();
或
$(textBox).parent().next().find('a')[0].focus();
但是这些代码不起作用
同时
$(textBox).parent().next().find('a').first()
返回:
<a role="menuitem" class=""><strong>101</strong>0320117585</a>
最佳答案
您的 anchor 似乎需要具有 href
属性(至少在 Chrome 中)。
如果您不需要特殊的 href
,您可以使用 href="javascript:void(0);"
关于javascript - focus() 方法在 jquery 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15183719/