[英]How to get Tab Index of active/focused control on page using javascript
I have controls on my page, is there any way I can get the tabIndex of active control or focused control? 我的页面上有控件,有什么方法可以获取活动控件或集中控件的tabIndex?
Thanx 谢谢
I'm assuming that you've got jQuery, since your question is tagged ASP.NET. 我假设您已经有了jQuery,因为您的问题被标记为ASP.NET。 In that case:
在这种情况下:
var tabIndex = $(':focus').attr('tabIndex');
should do it. 应该这样做。 If the element does not have an explicitly declared
tabIndex
attribute, the tabIndex
var will be undefined
. 如果元素没有显式声明的
tabIndex
属性,则tabIndex
var将是undefined
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.