addEventListener overwrites other event actions?

后端 未结 2 1591
太阳男子
太阳男子 2021-01-18 20:42

Does addEventListener overwrites previously defined actions for a particular event?For example,



        
2条回答
  •  天涯浪人
    2021-01-18 21:27

    No, it does not "overwrite" other handlers; that's why it's called "addEventListener". All the handlers are invoked when an event happens.

    Now, I will say that mixing the old-style "DOM 0" event handler attachment mechanism (the "onevent" attributes) with event handlers added with "addEventListener()" is not a very good practice.

提交回复
热议问题