3

i have a text input that is bound to focusin/focusout events.

$(element)
    .focusin(function(e) {})
    .focusout(function(e) {
        var to = e.relatedTarget || e.toElement;
        // undefined in chrome, fine in IE
    });

on focusout, i'm interested in the relatedTarget information, i.e., the DOM element receiving focus as the text input loses focus, however this property is undefined for the event.

on the other hand, toElement, which i believe is the internet explorer equivalient of relatedTarget, is available. in other words, my focusout handler works fine in IE, but not in other browsers.

is there a workaround for the above limitation?

4

1 回答 1

-1

来自MDC 文档

只有 MouseEvents 有这个属性

focusout不是鼠标事件,所以relatedTarget没有设置。IE 在这里没有遵循标准(什么是新的?)。

于 2011-01-10T23:01:01.270 回答