Fly with code

Get wet inside ocean of code

0%

Two ways to perform Event Listener

Use “onclick”

In traditional way, it’s fine to use “onclick”
but, the problem is
you can’t bind more than one event on the same element.
Here is the example, when clicking the first button
the rear one’s result will override the previous one.
Demo as below

Use event listener

If you use event listener, then you can attach as many events as you want on the same element.
Demo as below