Home  >  Q&A  >  body text

javascript - DOM event relatedTarget is null problem

addEventListener('dragenter', function(e) {
    //打印null
    console.log(e.relatedTarget);
});

But when the event is mouseover, the result can be printed normally.
I am puzzled, please ask for help

我想大声告诉你我想大声告诉你2685 days ago883

reply all(1)I'll reply

  • 滿天的星座

    滿天的星座2017-07-05 11:03:35

    relatedTarget event property returns the node related to the target node of the event.
    For the mouseover event, this property is the node that the mouse pointer leaves when it moves to the target node.
    For the mouseout event, this property is the node that the mouse pointer enters when leaving the target.
    For other types of events, this attribute is not useful.

    reply
    0
  • Cancelreply