如何在IE中使用relatedTarget(或同等功能)? [英] How to use relatedTarget (or equivalent) in IE?

查看:164
本文介绍了如何在IE中使用relatedTarget(或同等功能)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

显然,IE(11)在relatedTarget上有问题,例如在blur事件上. IE是否有替代方法来获取relatedTarget?

Apparently IE (11) has an issue with relatedTarget, for example on blur events. Is there an alternative for IE to get the relatedTarget?

以下是在IE中产生错误的示例: https://jsfiddle.net/rnyqy78m/

Here is an example that produces an error in IE: https://jsfiddle.net/rnyqy78m/

推荐答案

如果我查看此列表:

If I look at this list: https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/relatedTarget blur isn't included as having a standard secondary target. So I assume the secondary target on blur in chrome is non-standard.

如果您将模糊替换为focusin或focusout,那么它对我来说也适用于IE11.

If you replace blur by focusin or focusout, it also works for IE11 for me.

这篇关于如何在IE中使用relatedTarget(或同等功能)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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