Search code examples
javascriptinternet-explorereventsonblur

How to use relatedTarget (or equivalent) in IE?


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

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


Solution

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

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