mouseenter event called twice even after stopPropagation

后端 未结 4 840
南笙
南笙 2021-01-22 18:19

I\'m new to jquery and am facing now a weird problem. I succeeded to narrow it down to the fact that a mouseenter event is called twice: once for the containing div (this was my

4条回答
  •  时光取名叫无心
    2021-01-22 18:46

    The issue (after debugging) I see is. You have div and p inside it so...

    When you mouse over the div having p, first the div "mouseover" event is being fired which stores the whole html including p tag.

    But before writing this html back to the div the "p" mouseover is fired which replaces your data with the text and not the html.

    And then your text is being written out to the div finally.

提交回复
热议问题