开发者

jquery focusout event missing relatedTarget information

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 I开发者_C百科E
    });

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?


From the MDC docs:

Only MouseEvents have this property

focusout is not a mouse event, so relatedTarget is not set. IE is not following standards here (what's new?).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜