# Event Delegation

**URL:** <https://forum.kirupa.com/t/event-delegation/647824>\
**Category:** web dev\
**Created:** [June 6, 2021, 7:49am UTC](https://forum.kirupa.com/t/event-delegation/647824 "2021-06-06T07:49:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![abishek07](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/abishek07/32/14652_2.png) [@abishek07](https://forum.kirupa.com/u/abishek07)\
**Post date:** [June 6, 2021, 7:49am UTC](https://forum.kirupa.com/t/event-delegation/647824/1 "2021-06-06T07:49:58Z")

</div>

Hey, guys!  
I came here from this [tutorial](https://youtube.com/watch?v=Xwq1Hj1DyDM) on Kirupa’s channel.  
It deals with Event Delegation. I would really appreciate it if someone could help me with my question here:

> I am working on a chat app. Each chat element has children of its own. And all the chats are inside of a chatContainer.
> 
> Now, if I add the event listener to the chatContainer, how do I execute the callback only on the parent element(chat) even though the event was triggered by one of its children(chatChild)?

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [June 6, 2021, 5:21pm UTC](https://forum.kirupa.com/t/event-delegation/647824/2 "2021-06-06T17:21:56Z")

</div>

Welcome to the forum @abishek07! 😀

You can add the event listener to the parent container, and that may be all you need to do. If you tried that, was the event not reaching it?

Cheers,  
Kirupa 👽
