您的位置:首页 > 其它

怎样治疗<a>标签不能触发onblur事件

2018-08-17 15:23 621 查看
I realize this was over a year ago, but it showed up for me in Google while trying to solve this same issue.

It seems Chrome does not consider some elements, like body and anchors, to be "focusable". According to the following page, you can make any element focusable (thereby activating the blur event) by setting the tabindex attribute: http://www.quirksmode.org/dom/events/blurfocus.html

Like so:

<a href="#" tabindex="0" onblur="alert('blur')"> blur me </a>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Focusable Chrome Element