javascript blur event — is there any way to detect which element now has focus? [duplicate]

房东的猫 提交于 2019-12-14 00:48:18

问题


Does anyone have a technique that will allow me to determine which element has focus after a blur event? I have an input field which I'd like to reset on blur unless the blur was caused by the user clicking the "save" button. I'd love to just set a flag in the save button's onclick function, but that would fire too late (unless click events always fire before blur events, which I doubt.)


回答1:


Answered here; When onblur occurs, how can I find out which element focus went to?



来源:https://stackoverflow.com/questions/528208/javascript-blur-event-is-there-any-way-to-detect-which-element-now-has-focus

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