Skip to content

Latest commit

 

History

History
13 lines (7 loc) · 522 Bytes

File metadata and controls

13 lines (7 loc) · 522 Bytes

AddRemoveEventListenerJs

This recipe shows how to add and remove an event listener to an HTML element.

Expected Behavior:

Browser

Clicking the "Add listener" button will add an event listener to the button. When the main button is clicked, a message will be printed to the console. Clicking the "Remove listener" button will remove that event listener.

Clicking the "Remove 2nd Approach listener" button is self-explanatory.

Make sure to open the console with dev tools first, then reload/refresh the page.