javascript模糊事件 - 有没有办法检测哪个元素现在有焦点? [英] javascript blur event -- is there any way to detect which element now has focus?

查看:53
本文介绍了javascript模糊事件 - 有没有办法检测哪个元素现在有焦点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人有一种技术可以让我在模糊事件后确定哪个元素有焦点?我有一个输入字段,我想在模糊上重置,除非模糊是由用户点击保存按钮引起的。我只想在保存按钮的onclick功能中设置一个标志,但这样会触发太晚(除非点击事件总是在模糊事件之前触发,我怀疑。)

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.)

推荐答案

这里回答; 当onblur发生时,我怎样才能找出哪个元素重点

这篇关于javascript模糊事件 - 有没有办法检测哪个元素现在有焦点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆