DEV Community

Alex Nielsen
Alex Nielsen

Posted on

1 2

Event delegation in JavaScript

I have been making web development videos to help me solidify what I've been learning. This one is about event delegation in JavaScript. How to add one listener to multiple elements. https://youtu.be/buVEB6TI3VU

Top comments (3)

Collapse
 
jess profile image
Jess Lee

Hey Alex, just thought you might want to know that you can embed your videos directly in dev.to with this syntax:

{% youtube buVEB6TI3VU %}

Collapse
 
bushbass profile image
Alex Nielsen

Thank you! :)

Collapse
 
jay97 profile image
Jamal Al

Hey Alex nice vedio. In the video i saw the u were trying to get the event.target like this el.addEventListner("click", console.log(event.target))
But did not work. To make it work just pass {target} to console without event.

SurveyJS custom survey software

JavaScript Form Builder UI Component

Generate dynamic JSON-driven forms directly in your JavaScript app (Angular, React, Vue.js, jQuery) with a fully customizable drag-and-drop form builder. Easily integrate with any backend system and retain full ownership over your data, with no user or form submission limits.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay