Onblur,下一个将获得焦点的控件是什么? [英] Onblur, what is the next control which will gain focus?

查看:63
本文介绍了Onblur,下一个将获得焦点的控件是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在触发文本框的一些代码onblur().但是,如果用户单击取消"按钮导致该onblur(),我想做些不同的事情.在onblur()事件处理函数中是否有一种方法可以知道将要获得焦点并相应做出反应的控件是什么?

I am firing some code onblur() of a textbox. But I want to do something different if the user clicked on the cancel button to cause that onblur(). Is there a way within the onblur() event handler function to know what the control is that is about to receive focus and react acordingly?

-约瑟夫

推荐答案

是的,您可以像这样获得目标:

Yes, you can get the target like this:

var target = event.explicitOriginalTarget || document.activeElement;

(我想我是在StackOverflow上的某个地方找到的).

(I think I found this on StackOverflow somewhere).

这篇关于Onblur,下一个将获得焦点的控件是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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