Event Delegation in Javascript | UI/Frontend Interview Question

Поділитися
Вставка
  • Опубліковано 18 січ 2025

КОМЕНТАРІ • 161

  • @Abhishek-dp5tc
    @Abhishek-dp5tc 3 роки тому +92

    Benefits of event delegation:
    1) improves memory space
    2) mitigates risk of performance bottle neck
    3) Dom manipulation
    4) when elements get added dynamically, the process of adding events is slow
    Limitations:
    1) All the events are not bubbled up, some events like blur, focus are not bubbled up
    2) if e.stopPropogation is used in child, then events are not bubbled up

  • @cnsnmms3708
    @cnsnmms3708 3 роки тому +61

    Eventually found someone who really knows something and shares it on youtube :D

  • @shadestorm3995
    @shadestorm3995 3 роки тому +36

    I have been adding listeners on loop like an idiot when I could have just done this...
    This was enlightening to a great degree.

    • @mridulkumar4087
      @mridulkumar4087 3 роки тому +3

      Your are even adding a loop but I have been adding a event listener each and every time for every element

    • @jamesonvincent3779
      @jamesonvincent3779 3 роки тому +1

      i know im randomly asking but does someone know of a trick to log back into an instagram account?
      I stupidly forgot my password. I would appreciate any tricks you can give me!

  • @BaishaliGhosh13
    @BaishaliGhosh13 4 роки тому +14

    I have been terrified of frontend questions in fullstack positions but your videos have given me so much clarity and insight into the working of JS. Thanks a lot Akshay.

  • @user-uh3zr7mo4i
    @user-uh3zr7mo4i 5 років тому +10

    Dude! I love you . These videos are really helpful for self taught devs.

  • @saritajha1
    @saritajha1 3 роки тому +4

    You are absolutely right !! it opened my eyes when I actually understood this concept :)
    No tutorial/ video ever explained delegation this way. Can't thank more Akshay.
    God bless you.

  • @nemilidinneanusha1747
    @nemilidinneanusha1747 2 роки тому

    Thanks!

    • @akshaymarch7
      @akshaymarch7  2 роки тому

      Thank you for supporting the channel. ❤️

  • @nikhilupadhyay4191
    @nikhilupadhyay4191 3 місяці тому +1

    Benefits of event delegation.
    1.Less memory usage.
    2.Mitigates risk of performance bottleneck.
    3.Instead of writing multiple event listener task can be done in single event listener so writing less code is also a benefit
    4.When elements are dynamically added ,so adding events to the element is slow so event delegation eventually takes care of it.
    Limitation
    1.Not all events support event delegation.
    2.If stoppropogation is used on child elements eventually event delegation would not work.

  • @hardikluhar4738
    @hardikluhar4738 3 роки тому +3

    These videos are really helpful for self-taught devs.

  • @shishirsonekar5661
    @shishirsonekar5661 5 років тому +7

    Thanks, Akshay for this perfect explanation...
    Also,
    Being a full-stack developer and like me, a lot many FS devs keep ignoring CSS because it needs a proper understanding of not just the target element as well as the effects passed on from parents in the hierarchy. Overall, CSS being a secondary skill for this reason as well, it's not focused much in tech Interviews. But, I feel it is much-required skills to deliver a quality products. If you've cracked CSS properties' relations with its parents in the hierarchy, I'm sure huge junta including me would like to learn it from you!...

  • @onlynaveen
    @onlynaveen 5 років тому +2

    Hi sir, after 1 year learning you lesson me a practical and real things, Thanks for advise and teach.

  • @ryansantiago3684
    @ryansantiago3684 2 роки тому +1

    No joke, you are the best person when it comes to explaining. I really recommend you Akshay! Keep it up!

  • @sowmithreddy18
    @sowmithreddy18 4 роки тому +16

    Never knew data attributes could be used this way. Amazing !

  • @subhamshaw1726
    @subhamshaw1726 3 роки тому

    after namaste javascript, this frontend interview question playlist had helped me a lot. I can apply this things in my work as well as ace my interviews.
    All thanks to YOU, sir

  • @vandanachintala8326
    @vandanachintala8326 4 роки тому +3

    Thanks Akshay for awesome explanation of each topic. I have gone through your event bubbling and capturing video before this one. I think your first example regarding categories is the best example of enabling event capturing. Since we are attaching event handlers to parent - instead of events bubbling from child to parent, we can enable useCapture property and can stop delegation to child elements for better performance using e.stopPropagation().

    • @kirankamath5891
      @kirankamath5891 3 роки тому

      but how we will understand from where the event actually occurred if the target is the child element

  • @prabu2778
    @prabu2778 4 роки тому +1

    You are great !!!!!!?
    Helping so many poor people

  • @gyanendraverma3155
    @gyanendraverma3155 3 роки тому

    best javascript knowledge. I was looking at this kind of depth of knowledge in javascript.

  • @priyaranjan1733
    @priyaranjan1733 5 років тому +1

    In CSS, we use as event delegation mean, we assign our base tag's href for all tags in that page. This is just analogy for those who know but not Event Delegation. 😕

  • @lovishgoel2745
    @lovishgoel2745 4 роки тому +1

    best series so far

  • @md.mohiulislam6516
    @md.mohiulislam6516 2 роки тому

    This guy is awesome. Love from Bangladesh.

  • @codingwithgraceandtruth2456
    @codingwithgraceandtruth2456 2 роки тому

    hooked to your tutorials, really good quality in teaching and content.

  • @samdatta9163
    @samdatta9163 4 роки тому +1

    Good Quality and informative video.I kept all the concepts in my mind for interview.Thanks so much.

  • @SAIRAM-ct5cy
    @SAIRAM-ct5cy 3 роки тому +1

    Good job Akshay..its amazing how you present the concepts precisely.Keep up the good work!!

  • @ishusharma415
    @ishusharma415 3 роки тому

    Really useful information and very well explained lectures. One of the best channel to prepare for front end interviews. Thank you so much for creating this channel.

  • @thealgomasters
    @thealgomasters 12 днів тому

    Amazing examples, very very easy to learn

  • @iqrarhussain7136
    @iqrarhussain7136 7 місяців тому

    Very beautiful concept, and beautifully taught by Akshay sir.

  • @chamnil8666
    @chamnil8666 4 роки тому

    Thank you for making these free videos.They are so educational.keep up the good work.

  • @gokulsrinivasan8563
    @gokulsrinivasan8563 3 роки тому

    Akshay,Thank you so much these videos. You explanation is pretty clear. Thanks again.

  • @charanckck
    @charanckck 3 роки тому

    Love you man. Thanks for your time and knowledge.

  • @shoaib_akhtar_1729
    @shoaib_akhtar_1729 7 місяців тому

    Hats off, awesome teaching skills.

  • @PeaceUrSoul
    @PeaceUrSoul 4 роки тому +1

    Hi Akshay, thanks for bringing such insights logics. Keep post such videos..

  • @ShouvikMitraPlus
    @ShouvikMitraPlus 5 років тому +34

    Nice one! also got to know how frameworks make use of custom attributes like data-dismiss="modal" in bootstrap. Thanks!

    • @akshaymarch7
      @akshaymarch7  5 років тому +50

      You're absolutely right Souvik and the people who write frameworks are just like us, it's just that they understand these core concepts very well and how things work under the hood. Keep on learning these basic concepts and slowly everything will make sense and you will get a lot more wow moments. :)

    • @Abhishek-do8mp
      @Abhishek-do8mp 3 роки тому +1

      @@akshaymarch7 ab to aajao sir

  • @iaindudman3349
    @iaindudman3349 2 роки тому

    Excellent examples and explinations👍

  • @mohann7750
    @mohann7750 4 роки тому

    Thanks Dude..Helped me to learn events in javascript in depth..

  • @TanayBhalani
    @TanayBhalani 3 роки тому

    Amazing video, learnt a lot✌️ thank you Akshay 👍

  • @madhavdua8588
    @madhavdua8588 Місяць тому +1

    Very helpfull sir

  • @navdeepsr93
    @navdeepsr93 5 років тому +1

    Thanks Akshay , you explained very nicely . :)

  • @shivGGG
    @shivGGG 4 роки тому +1

    Amazing stuff, great way of teaching :)

  • @Siddarthathota
    @Siddarthathota 5 років тому +1

    Awesome explanation man.. kudos

  • @kalyanparri8517
    @kalyanparri8517 3 роки тому

    Thanks for information sharing

  • @SauravKhare
    @SauravKhare 10 місяців тому

    Really useful examples.

  • @anandyadav_
    @anandyadav_ 3 роки тому

    older videos are one level good than newer ones😋

  • @dinesh9896
    @dinesh9896 Рік тому

    thank you brother for making it very clear!

  • @mohitkushwaha8156
    @mohitkushwaha8156 3 роки тому

    Video is very helpful
    grateful to you

  • @profjs2398
    @profjs2398 3 роки тому

    excellent video, thank you Akshay

  • @priyankachhabria6769
    @priyankachhabria6769 3 роки тому

    This was amazing. Thanks for making it so simple.

  • @jayanthbondi4251
    @jayanthbondi4251 3 роки тому

    Wonderful explanation !!

  • @suthagarthambikannu6402
    @suthagarthambikannu6402 4 роки тому

    nice video and simple understandable English. Very useful for me

  • @himanshushekhar3694
    @himanshushekhar3694 4 роки тому

    such a nice video with great explaination...Thank you so much

  • @pritamchowdhury4191
    @pritamchowdhury4191 4 роки тому +1

    It was just fantastic.Thank you so much brother

    • @pritamchowdhury4191
      @pritamchowdhury4191 4 роки тому

      can u make a video about how javascript engine works.thanks in advance

  • @sagarkumar4816
    @sagarkumar4816 3 роки тому

    awesome video .. very informative .. please make more videos

  • @MujahidAli-gi6jk
    @MujahidAli-gi6jk 2 роки тому

    I just only sy kitna awesome parhata ha yar

  • @Priyanka_12321
    @Priyanka_12321 Рік тому

    Thank you so much sir 😀🙏

  • @tusharkrishna8149
    @tusharkrishna8149 4 роки тому +1

    Your explanation is too good, can you make a video on java script timers please

  • @VinayVerma22
    @VinayVerma22 5 років тому +1

    Very nice and precise tutorial with great examples. Requesting you to make a video on "Event Loop". :)

  • @AdnanAli-cp9hk
    @AdnanAli-cp9hk 8 місяців тому

    amazing amazing amazing!!!!

  • @DharmendraKumar-qk5bt
    @DharmendraKumar-qk5bt 5 років тому +1

    It's awesome. Thanks

  • @sumonbarai178
    @sumonbarai178 Рік тому

    thanks for totorial.....

  • @aburaihan-py4vi
    @aburaihan-py4vi 3 роки тому

    Excellent!

  • @snehashischattopadhyay9519
    @snehashischattopadhyay9519 4 роки тому

    bro learning a lot from your videos. Please please please upload more videos on Javascript. Also if possible discuss on tricky CSS, HTML questions.

  • @anonymousshooter3636
    @anonymousshooter3636 4 роки тому

    Very Informational

  • @namankeshari7332
    @namankeshari7332 Рік тому

    Awesome video once again!

  • @MrMaulikthaker
    @MrMaulikthaker 3 роки тому

    second example when you type anything then that much time function is called. So I think its the case of function re-calling wihile each character we typed in event delegation.

  • @MunshiWahid
    @MunshiWahid 4 роки тому

    This video should get more likes

  • @TheRichEng
    @TheRichEng 5 років тому +1

    Awesome brother

  • @musicsubhankar
    @musicsubhankar 3 роки тому

    This was nicely explained. Keep up the good work. :)

  • @dhrumit7
    @dhrumit7 2 роки тому

    @Akshay Saini
    Your videos are very insightful. Please do one video on Infinite Scroll and Pagination.

  • @12vvs
    @12vvs 5 років тому +1

    Great!

  • @creativemind4116
    @creativemind4116 2 роки тому

    Thanks for your valuable explaination.
    now i'm bit confuse between event bubbling and event deligation.

  • @SHIVAMPANDEYSJTG
    @SHIVAMPANDEYSJTG 2 роки тому

    You are awesome!

  • @hundredeyes7759
    @hundredeyes7759 5 років тому +3

    Finally I got it!!. is this the same way how react-router work? i mean like not exactly the same but core concepts are this only right?

    • @akshaymarch7
      @akshaymarch7  5 років тому +1

      I don't know exactly about it. React router is all together a giant concept, won't be this simple. But yeah this concept is often used for setting behaviour patters in the code :)

  • @surabhipal9553
    @surabhipal9553 3 роки тому

    Thank you

  • @simranbhatia2402
    @simranbhatia2402 3 роки тому

    Superb

  • @karensanchez7308
    @karensanchez7308 4 роки тому

    Superb, thanks.

  • @Rajavinoth1981
    @Rajavinoth1981 5 років тому +1

    Super

  • @bahaakrayem4104
    @bahaakrayem4104 5 років тому +1

    Great

  • @jayanthbabusomineni557
    @jayanthbabusomineni557 5 років тому +1

    Please make video on closures in JavaScript

  • @kiranmahajan778
    @kiranmahajan778 10 місяців тому

    In event delegation we would have to write a lot of if and else condition to handle different click events

  • @vitalvisions4U
    @vitalvisions4U 3 роки тому

    Got this too.

  • @valurathod8579
    @valurathod8579 4 роки тому

    Dude your videos are awesome and useful.. Can you please make video on angular?

  • @videosforinventionimaginat2410
    @videosforinventionimaginat2410 4 роки тому

    Sir very nice , video very simple, clear and directly getting into our head
    Sir also make real time video of securing API , and make webpage loading g faster in UI

  • @sandeepadiyar001
    @sandeepadiyar001 4 роки тому

    Thanks very much akshay. Yours videos are very helpful and quite descriptive and understandable. Can you please make one video on webpage security. I mean from a frontend developer point of view how can I add security to a web app. Thanks in advance

  • @somhrikkonar6147
    @somhrikkonar6147 2 роки тому

    Thanks

  • @velmurugan.personel
    @velmurugan.personel 5 років тому

    Awsome Akshay..... Make video on "Event Loop"

  • @sanauwari
    @sanauwari 4 роки тому

    I m digging your videos 😁

    • @akshaymarch7
      @akshaymarch7  4 роки тому +2

      Jasoos 🕵️

    • @sanauwari
      @sanauwari 4 роки тому

      @@akshaymarch7 Finally got response from you😁
      Digging is in progress till find the gem of javascript.
      Thanku so much for you efforts 🙏

  • @koondrapuvenkatasaiteja7499
    @koondrapuvenkatasaiteja7499 День тому

    Why "e.target.id" is not getting printed in the console, at 15:15 and at 17:01..…...? Anyone please reply

  • @samadhansalgar9181
    @samadhansalgar9181 3 роки тому

    !! Its so easy to learn from your @video Thanks lot for such great video !!! ,
    Please cover one fronted template with javscript, Jquery if possible with AJAX, animation
    or only with Javascript with animation

  • @AshishPatelIndia
    @AshishPatelIndia 2 роки тому

    ❤❤❤

  • @AbhishekGupta-bg8wt
    @AbhishekGupta-bg8wt 5 років тому

    please make more videos on these type of things

  • @techbjunks
    @techbjunks 5 років тому +1

    we can also do event delegation with capturing phase.

  • @sahilsatishkumar
    @sahilsatishkumar 4 роки тому +1

    So I am not the only person who is reminded of the time by them machines

  • @manojkumarsah900
    @manojkumarsah900 2 роки тому

    Thx more knowledge video but Request video Virtual DOM and Actual DOM

  • @shubamdadhwal3497
    @shubamdadhwal3497 2 роки тому

    Excellent Explanation Akshay, I have a minor doubt - as you have said it we can only do event delegation because of event bubbling, but while playing with the code, when i set the useCapture flag to true, it was working perfectly fine too, can you explain this behaviour?

  • @larrysmusics531
    @larrysmusics531 3 роки тому

    Perfect

  • @ashwanipayal8658
    @ashwanipayal8658 4 роки тому

    Nice!

  • @abhilayman8533
    @abhilayman8533 5 років тому

    document.getElementById is faster than document.queryselector , so use the first one.

  • @shabnamnaaz4676
    @shabnamnaaz4676 4 роки тому

    thankyou

  • @PeaceUrSoul
    @PeaceUrSoul 4 роки тому +4

    At 8:50 , 21 hours of what??

    • @akshaymarch7
      @akshaymarch7  4 роки тому +2

      Hahaha, that's my system saying it's 21 hours. I've turned on the speaking clock. I was actually shooting the video at 09:00 PM. Forgot to trim that portion, nice catch. 😅

    • @prakhar992
      @prakhar992 4 роки тому +1

      It happened in another video as well😅

  • @sunilthind3257
    @sunilthind3257 3 роки тому

    @akshay
    Can you please show in a video how can we achieve event delegation in react components