addEventListener overwrites other event actions?

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

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



        
2条回答
  •  南笙
    南笙 (楼主)
    2021-01-18 21:35

    No.

    From MDC:

    addEventListener is the way to register an event listener as specified in W3C DOM. Its benefits are as follows:

    • It allows adding more than a single handler for an event.

    See example.

提交回复
热议问题