Event Delegation in JavaScript, Simplified

Поделиться
HTML-код
  • Опубликовано: 30 окт 2022
  • Event Delegation is an event handling pattern based up on the concept of Event Bubbling in the DOM. The idea is that you delegate the handling of an event (triggered on an element) to its parent or ancestor element.
    This can improve performance in your applications as you use fewer event listeners for the same logic.
    Learn about Event Bubbling here: • Event Bubbling in Java...
    Learn about the querySelector document method here: • HOW TO SELECT DOM ELEM...
    _____
    Subscribe to My Channel: bit.ly/deeecode
    _____
    🌟 About Me:
    Dillion Megida, creator of DEEECODE, is a Software Engineer, Developer Advocate and a Content Creator passionate about simplifying topics around Tech via articles and videos.
    _____
    ⚡️ Connect with me:
    - Personal youtube: / dillionmegida
    - Personal website: dillionmegida.com/
    - Twitter: / iamdillion
    - Instagram: / deeecode
    - LinkedIn: / dillionmegida
    - GitHub: github.com/dillionmegida
    _____
    #deeecode
  • НаукаНаука

Комментарии • 62

  • @tommuc8538
    @tommuc8538 Год назад +2

    Wow, that was super clear and simply. Thx.

    • @deeecode
      @deeecode  Год назад

      Glad you liked it! You're welcome

  • @riyatiwari7178
    @riyatiwari7178 Год назад

    Thank you so much, loved it! Keep uploading this series. ❣❣

  • @victortarroni
    @victortarroni 11 месяцев назад

    Super clear! Thanks Mate!

    • @deeecode
      @deeecode  10 месяцев назад

      So glad to hear. you're welcome!

  • @timeless268
    @timeless268 6 месяцев назад

    The explanation is AWESOME ! Thank you so much❤

    • @deeecode
      @deeecode  6 месяцев назад

      So so glad it was helpful!

  • @PaulJBurgess
    @PaulJBurgess 4 месяца назад

    Thank you! I'll be back to this channel, I'm pretty sure.

  • @mlindatech
    @mlindatech 10 месяцев назад

    Man you are wonderfully simple English straight to the point beautiful✌️🙏

    • @deeecode
      @deeecode  10 месяцев назад

      Thanks for the feedback 🙌🏾

  • @FranklinAirlonger-jm3pj
    @FranklinAirlonger-jm3pj 11 месяцев назад +1

    You’re good bro, the simplicity of your classes are superb

    • @deeecode
      @deeecode  10 месяцев назад

      I appreciate that! Glad you like them

  • @BriariusTitan
    @BriariusTitan 9 месяцев назад

    Thanks for the help, you clarified it well.

    • @deeecode
      @deeecode  8 месяцев назад

      You're welcome!

  • @HarshSingh-hk8fe
    @HarshSingh-hk8fe 8 месяцев назад

    that's really a cleanest explaination no bullshit straight to the point thanks alot bro

    • @deeecode
      @deeecode  8 месяцев назад

      So glad you find it helpful 😊

  • @user-nm7in5cm3q
    @user-nm7in5cm3q 10 месяцев назад

    great video - thank you!!

    • @deeecode
      @deeecode  10 месяцев назад

      You're very much welcome!

  • @adibahbab6859
    @adibahbab6859 10 месяцев назад

    Thanks man.....

  • @keddycameron2723
    @keddycameron2723 Год назад

    very clear! thank u

  • @JD-hq1kn
    @JD-hq1kn Год назад

    You really simplify things.. Thanks man !!

    • @deeecode
      @deeecode  Год назад +1

      you're super super welcome :)

    • @JD-hq1kn
      @JD-hq1kn Год назад

      @@deeecode how can I get in touch with you bro ?

  • @RishabhJain-uv7zj
    @RishabhJain-uv7zj 6 месяцев назад

    Nice explanation. Thanks

    • @deeecode
      @deeecode  6 месяцев назад

      Glad it was helpful!

  • @himxai
    @himxai 8 месяцев назад

    Thanks love your explanation 💯

    • @deeecode
      @deeecode  8 месяцев назад

      Glad it was helpful!

  • @walkingalonewithyusuf9987
    @walkingalonewithyusuf9987 10 месяцев назад

    Your teaching style is really amazing ❤❤❤

    • @deeecode
      @deeecode  6 месяцев назад

      Glad you enjoyed it

  • @Wildrespect
    @Wildrespect 9 месяцев назад

    Nahh… this tut right here is dope🔥

    • @deeecode
      @deeecode  9 месяцев назад

      I’m glad you find this so 😀

  • @york2301
    @york2301 Год назад

    Keep up the good work!

  • @gaurangshroff
    @gaurangshroff Год назад

    Very well explained

  • @malikmartin
    @malikmartin 3 месяца назад

    Thanks! This should help me write cleaner (and more optimized) code!

    • @deeecode
      @deeecode  3 месяца назад

      Glad it helped!

  • @hybs9473
    @hybs9473 Год назад +5

    Maaan! Thank you for this. You use simple english to explain things, straight to the point, very concise with a lot of examples. I easily understood what event delegation is. Only gripe I had is the 'target' event not explained enough, but that's on me, I need to research more on that. Thank you very much. Might check out your other tutorials because of how well you teach the topics. Hope you get a lot of subscribers so you get motivated to post more good tutorials like this.

    • @deeecode
      @deeecode  Год назад +1

      Thank you so much for the helpful feedback 🙏🏾 I appreciate it. And thanks for the kind words also
      You mean the target object not being explained clearly?

    • @hybs9473
      @hybs9473 Год назад +1

      @@deeecode Hey man, Yes, that target object, but that's on me, I have to research that on my own to learn further.
      Can I request some topic for other videos? Can you do a tutorial for promise, async and await and a separate video talking about JSON and API's? I'm currently enrolled on UDEMY but I like your teaching style more (slow and clear that is more suitable for beginners).
      Thank you man, don't sweat my request too much, I understand that it's pretty hard to slip these things in your schedule.

    • @DillionMegida
      @DillionMegida Год назад +1

      @@hybs9473 I appreciate your feedback. I'll push in event.target on my list. Promises, async and await are already there--scheduling a time is the problem. Will also add JSON and APIs to the list. But what I can say right now is that expect a video on event.target on my channel soon. Will leave a comment here when I do that :)
      Thanks again for the engagement. And I love that my videos are simple enough 😇

    • @deeecode
      @deeecode  Год назад

      Here is the video on event target ruclips.net/video/N9vEXAWPynU/видео.html 😇
      I would love your feedback on it after watching, if it's simple enough. Thank you

    • @joelfuelling8725
      @joelfuelling8725 Год назад

      @@DillionMegida Fun tip, change your e.target to a variable right away you can reference so you're not writing e.target everywhere.

  • @PonnaiyaSwami
    @PonnaiyaSwami 6 месяцев назад

    maaaaaaaaaaaaaaaaan!! you're a legend.

    • @deeecode
      @deeecode  6 месяцев назад

      Glad you found the video helpful :)

  • @cescr3821
    @cescr3821 Год назад

    awesome dude ty.

    • @deeecode
      @deeecode  Год назад +1

      You're greatly welcome!

  • @hamzamellahi120
    @hamzamellahi120 6 месяцев назад

    Loooove it, keep it uP!

    • @deeecode
      @deeecode  6 месяцев назад

      Thank you! Will do!

  • @PaulJBurgess
    @PaulJBurgess 4 месяца назад

    Subbed!

  • @Vc00018
    @Vc00018 Год назад

    very helpfull !!

    • @deeecode
      @deeecode  Год назад +1

      Glad it was helpful!

  • @godugunurumanoj733
    @godugunurumanoj733 8 месяцев назад

    Awesome explanation i loved it.

    • @deeecode
      @deeecode  8 месяцев назад

      Glad it was helpful!

    • @godugunurumanoj733
      @godugunurumanoj733 8 месяцев назад

      Yes I am confident about this concept

  • @thefootballcore
    @thefootballcore 4 месяца назад

    hey, do you play football , if yes, Chelsea is ready to sign you mate , you match perfectly with their needs

  • @youtubejproasters1224
    @youtubejproasters1224 11 месяцев назад

    Hey man nice video, out of curiosity, what if you had to put in these 3 buttons a different action to happen after a click event, would you make the if statement with their ids as validator? And you would make 3 if statements for different action if event.target === button 1 for example etc etc ?

    • @mlindatech
      @mlindatech 10 месяцев назад +1

      I really like your question man!

    • @shishirbhurtel7978
      @shishirbhurtel7978 6 месяцев назад +1

      See the complexity of your application. If the purpose of the different buttons/child inside parent element have less distinct or similar purpose, you can use conditional handling. Else if they have distinct purposes using different eventListners in each buttons/child will be more helpful.