Learn JavaScript DOM Traversal In 15 Minutes

Поделиться
HTML-код
  • Опубликовано: 3 июл 2024
  • 🚨 IMPORTANT:
    JavaScript Simplified Course: javascriptsimplified.com
    Traversing the DOM in JavaScript is crucial to building projects on your own. In this video I break down all the ways you can traverse the DOM in JavaScript so that you can more easily build projects on your own.
    📚 Materials/References:
    CSS Selector Video: • Learn Every CSS Select...
    🧠 Concepts Covered:
    - How to traverse up the DOM
    - How to navigate down the DOM
    - All the methods for DOM traversal
    🌎 Find Me Here:
    My Blog: blog.webdevsimplified.com
    My Courses: courses.webdevsimplified.com
    Patreon: / webdevsimplified
    Twitter: / devsimplified
    Discord: / discord
    GitHub: github.com/WebDevSimplified
    CodePen: codepen.io/WebDevSimplified
    ⏱️ Timestamps:
    00:00 - Introduction
    01:34 - getElementById
    03:04 - getElementsByClassName
    04:16 - QuerySelector
    06:48 - querySelectorAll
    07:50 - Selecting Children
    09:19 - Selecting Descendants
    10:39 - Selecting Parents
    12:00 - Selecting Ancestors
    13:15 - nextElementSibling
    13:51 - previousElementSibling
    #DOMTraversal #WDS #JavaScript

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

  • @SocksWithSandals
    @SocksWithSandals 3 года назад +121

    This is great for jQuery dinosaurs like myself who are moving to ES6.

  • @mznunaya
    @mznunaya 3 года назад +12

    I JUST got done telling my bootcamp instructor how I need to review the DOM. And then I open my phone and see a notification for this video. Got dammit Kyle you've done it again. 👏

  • @xenialxerous2441
    @xenialxerous2441 3 года назад +28

    Hi!! I just wanted to say, that your channel and your videos are true to their perfection. As the name goes so as the content 🤗 Love you bro, your efforts are forever appreciated!!

  • @mateonavarrette4864
    @mateonavarrette4864 3 года назад +8

    Great rundown! I never really solidified my DOM traversal skills in my coding bootcamp, we just touched on a bit of vanilla js then jumped into react. Thanks for clearing some of my confusion up

  • @neelamchaubey28
    @neelamchaubey28 3 года назад +5

    Thanks so much for explaining the most powerful DOM Traversal methods in such an easy way, Kyle!
    Keep up the good work👍

  • @cacup7
    @cacup7 3 года назад

    The best traversal class. You rock on teaching and you are proving for each video that you are simplifying the web for everybody. Congratulations, man

  • @Ayomikun
    @Ayomikun 3 года назад +13

    I just realised that I've learnt soo much JavaScript / React from you, it's ridiculous. Thank you!

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

    One of the best videos that I have seen for traversing the DOM. It's extremely easy to understand to the point, and very clear on what each action does!

  • @Dameworth
    @Dameworth 3 года назад +1

    You’re a natural teacher, thanks for all the videos!

  • @alinademi
    @alinademi 3 года назад +1

    It really did simplify the most important parts of the DOM traversal. Awesome job!

  • @devt.9712
    @devt.9712 2 года назад

    Dude you are amazing.Thanks for making that Frontend/Backend guide, it's so easy to follow and makes my learning process a lot easier. Love you!

  • @roey6541
    @roey6541 3 года назад +48

    Such a pleasure watching you explain! These concepts can be tough but you're very assuring and confident. I rightaway went to check out your js course, and purchased it immediately. Looking forward on starting! Feels like the first day of school :)

  • @NecquiTeja
    @NecquiTeja 3 года назад +7

    Thank you... appreciate your efforts in making these videos. Keep it up my friend.

  • @pabhay235
    @pabhay235 3 года назад

    too good with very simple examples. it cleared my concepts in 14 minutes sharp.... much appreciated

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

    These explanations are so clean, congrats on that!

  • @mustafeezahmed9536
    @mustafeezahmed9536 2 года назад +1

    Hey Kyle, your videos literally blown my mind. So much knowledge with so ease. Thanks a Lot buddy!

  • @ThiagoVieira91
    @ThiagoVieira91 3 года назад

    Had to deal with these this week. This video would help a lot. Thank you Kyle! 👍🏼

  • @makiaboabida
    @makiaboabida 2 года назад +1

    This is amazing man. Thank you for making this video!

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

    You're very good at explained things, it show us that it's not as difficult as we thought, actually it's really simple.

  • @coolcha
    @coolcha 3 года назад +3

    Very good video and I appreciate the timestamps as I knew some but I could skip to those which were new to me.

  • @fawwazhosein
    @fawwazhosein 3 года назад

    Great revision. Thanks man!

  • @ntnurobert218
    @ntnurobert218 3 года назад +1

    Great ! I learned “closest”. Thank you

  • @pedrohenriqueduartebueno6873
    @pedrohenriqueduartebueno6873 3 года назад +7

    Your explanation is pretty good, 👍🏻👍🏻👍🏻

  • @francisugorji5639
    @francisugorji5639 2 года назад

    Thank you for simplifying JavaScript. I always learn new stuffs when I watch your videos

  • @Rohan-bg8ci
    @Rohan-bg8ci 3 года назад +2

    Thanks for revision!!!

  • @alexzhang9031
    @alexzhang9031 2 года назад

    Absolutly amazing video!

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

    The tutorial is super useful and easy to understand. And it solve the problem that bothered me for 2 days . Thank you so much

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

    great guide, literally the best material online for learning DOM

  • @digigoliath
    @digigoliath 3 года назад

    Awesome!! Well explained & easy to follow!

  • @Soap_js
    @Soap_js 3 года назад +66

    00:00​ - Intro
    01:34​ - getElementById
    03:04​ - getElementsByClassName
    04:16​ - QuerySelector
    06:48​ - querySelectorAll
    07:50​ - Selecting Children
    09:19​ - Selecting Descendants
    10:39​ - Selecting Parents
    12:00​ - Selecting Ancestors
    13:15​ - nextElementSibling
    13:51​ - previousElementSibling

  • @joanclarke2724
    @joanclarke2724 3 года назад

    Great tutorial. I have learnt so much from it. Thanks Kyle

  • @sacrajah
    @sacrajah 3 года назад

    Thank you , Kyle . I learnt something today.

  • @IELTSMANTRA-wy1rl
    @IELTSMANTRA-wy1rl 8 месяцев назад

    You are literally the best teacher with clear explanations .. totally awesome content .. thank u so so much ..

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

    Thank you so much !!!! One of the best videos!!!!

  • @skylerjknight
    @skylerjknight 3 года назад

    Nice simple tutorial. Thanks.

  • @jomesias
    @jomesias 3 года назад +4

    Cool tutorial! This is exactly what moustache binding replaces, so no more direct DOM calls (of course react ref can always be used for specific scenarios ). Though dom tree navigation is still needed for certain applications, js frameworks are phasing this out. For better or worse👍👍👍
    Btw THAT IS A KILLER LOOKING JACKSON GUITAR IN THE BACK! Loving it 🎸 🎸 rock on. 0:01

  • @user-zd8nu5sl2j
    @user-zd8nu5sl2j Год назад

    just start learning web dep, absolutely love all your videos, thank you for making and sharing those ❤

  • @espiritualidadedesvendada
    @espiritualidadedesvendada 2 года назад

    It really helped me... Thank you very much !!!!

  • @chickendev5759
    @chickendev5759 3 года назад

    concise and easy to understand

  • @guptarishav50
    @guptarishav50 3 года назад

    Great Vid. Thank You!!

  • @amiraalabeedi541
    @amiraalabeedi541 5 месяцев назад

    Thank you. Iv watched several videos of js and css in this channel. Very very useful.

  • @sashatv138
    @sashatv138 3 года назад

    Super! Thank you, Kyle!

  • @pedrocxbx
    @pedrocxbx 3 года назад

    Amazing, thanks Kyle!

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

    beautiful way of explanation

  • @mitch1668
    @mitch1668 2 года назад

    Excellent explaining.

  • @saidibrahim5931
    @saidibrahim5931 3 года назад

    wow your teaching skill is amazing

  • @MbahmukongDestiny-up3tv
    @MbahmukongDestiny-up3tv 3 месяца назад

    Your methods are fascinating thanks alot🎉

  • @ohhellothere1111
    @ohhellothere1111 3 года назад +9

    Havent used query selectors on anything other than document and first time seeing closest() method aswell. Good vid thanks dude :)

    • @bentoth4324
      @bentoth4324 3 года назад +1

      closest() is crucial, especially when dealing with events. (almost) never go up with a while loop

  • @zhumabayevorymbek2548
    @zhumabayevorymbek2548 2 месяца назад

    Brilliant!) Explained many things for me)

  • @shahidshafi1227
    @shahidshafi1227 2 года назад

    You Just made DOM easy for me ❤️. Thanks a lot .

  • @FirdavsiWebDev
    @FirdavsiWebDev 3 года назад

    Great tutorial, man!

  • @hellyski
    @hellyski 3 года назад

    Great video! Thank you.

  • @RemnantOfYahweh
    @RemnantOfYahweh 3 года назад

    Subbed, watched full vid and clicked the bell icon. Thanks dude you are the G.O.A.T!

  • @skaywalker20
    @skaywalker20 3 года назад

    Very helpful stuff, thank you so much!

  • @aresfrt
    @aresfrt 3 года назад

    Great teacher, great job

  • @webartem
    @webartem 3 года назад

    I like the way you explain it so much! even gonna forgive you missed semicolons and different quotation marks

  • @alfredolino8203
    @alfredolino8203 3 года назад +54

    I always learn a new thing from you, no matter what. Greetings from México.

    • @TheinfinityLight
      @TheinfinityLight 3 года назад +1

      Epaaa otro Mexicano aprendiendo, muy buena. Saludos paisa

    • @alfredolino8203
      @alfredolino8203 3 года назад +2

      @@TheinfinityLight Saludos compa

    • @bk._550
      @bk._550 3 года назад +1

      @@alfredolino8203 hola

    • @cmnweb
      @cmnweb 3 года назад +1

      Que pedo....

    • @TheinfinityLight
      @TheinfinityLight 3 года назад +1

      @@cmnweb Qué pedo banda! ✌️

  • @ashse4424
    @ashse4424 3 года назад

    Superb Brother, Thank you so much.

  • @Gerry090
    @Gerry090 3 года назад +8

    For those who are on the fence about his JS course, I suggest you buy it. I'm following his course and I can tell you that Kyle is a great teacher!

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

    super super useful. Noone actualy talk much about dom traversal, but this is the most important thing when you learning JS. I had soooo much problems with that cos i know some programming in other languages and have ideas how to do smth in js, but i cannot simply connect my code to my html+css page, now it looks super easy.

  • @rinkeshgokulchandani4181
    @rinkeshgokulchandani4181 3 года назад

    Good Content, learned some new things!

  • @TheCodingOdyssey
    @TheCodingOdyssey 3 года назад +2

    This was interesting to me. I am a self-taught developer, but mostly worked pretty extensively with React in my job so not much vanilla javascript dom manipulation which I am looking to learn more.

  • @codeandcurious
    @codeandcurious 3 года назад

    Thank you so much for the video

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

    now i understand dom! thank you

  • @rgablejr
    @rgablejr 3 года назад

    Great examples!

  • @mehniyarif2
    @mehniyarif2 3 года назад

    thank you bro. love from Türkiye

  • @funkykong9001
    @funkykong9001 3 года назад

    AMAZING! Thanks!

  • @kidgamer4787
    @kidgamer4787 2 года назад

    you are too good to describe for words!!!!!

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

    Thanks Thanks Thanks , Great Tutorial

  • @AcheiversOfficial
    @AcheiversOfficial 3 года назад

    very helpful. May the force be with you. 👍.

  • @curiosabouttech
    @curiosabouttech 2 года назад

    Thank you so much I wish you the best.

  • @dariusz8005
    @dariusz8005 2 года назад

    Thanks ! You are helped me too !! :)

  • @naveen7513
    @naveen7513 2 года назад

    I am following your front end development road map as the stepping stone for my career bro. Seriously they way u explain is great and i think by following ur tutorial i can be placed in MNC or other web development firm sooner. But few things I can’t understand quickly it doesn’t mean ur teachings are not good it’s just me who is slow at the moment. But i am trying to push my limit to the end to grab the knowledge of how programming works. Thanks man!❣️🙏🏻

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

    I am so glad I am in your discord. Someone just saved my life lol or helped me with this. I also love your CSS Battles. You should do that with JS to see how you both differ in your writing functions, that would be awesome to see.

  • @michelaveline
    @michelaveline 3 года назад

    Thanks, again!

  • @passandscore_
    @passandscore_ 3 года назад

    Another great video!!

  • @MrDflego
    @MrDflego 3 года назад

    I got a whole lotta love for this video.

  • @_Jordo
    @_Jordo 3 года назад +3

    I thought I knew all this but watched just in case. You taught me that closest goes upward. Thanks!
    PS. I am curious to see how you look without your hair styled haha

  • @HolisticPython
    @HolisticPython 3 года назад

    Thanks for all the free tutorials. Wondering if you could do a video on just general coding fatigue and any tips on how to remedy it?

  • @carltongordon
    @carltongordon 3 года назад +1

    9:50 is such a shocker I had no idea thanks yo!

  • @russellabraham9208
    @russellabraham9208 3 года назад

    Happy to see this video. I think you could have mentioned a few more details for a more rounded look at scope with querySelector. Also you can traverse in a chain with closest().querySelector().closest().querySelector().closest().

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

    Thank you very much.

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

    Thank you!

  • @LanguageSkillz
    @LanguageSkillz 2 года назад

    9:09 makes me have to clarify traversing along parent children across parent siblings. It comes up a lot with some layouts. Kudos with distinguishing closest for ancestors, and I appreciate how you go about familiarizing usage of techniques like detailing .children properties on a variable and converting with Array.from to establish an array simple to handle with .forEach. Built-in properties of ES6.

  • @dhawalparmar7117
    @dhawalparmar7117 2 года назад

    Bro it is best youtube channel for javascript tips and tricks....Please make tutorial on angular react and vue

  • @thelostvorg7805
    @thelostvorg7805 2 года назад

    I checked the Timestamps and I was like meh I know all of these but I watched the video anyway because you never know what you will find and then you mentiond the closest() function which I never knew existed ! I'm glad I stayed till the end of the video!

  • @Adam-iq6zn
    @Adam-iq6zn 3 года назад +3

    I work as Front-end Dev for 2 years now (small and medium software companies), and I didn't know about closest, nextElementSibling and previousElementSibling methods at all 😲
    Usually I write my own functions to find specific parent or sibling.
    Thanks for enlighten me about this xD

  • @Anju_2014_
    @Anju_2014_ 3 года назад

    Great content..bro..thanks

  • @danielbark
    @danielbark 3 года назад

    Thanks Kyle! Great stuff in this one!

  • @bernardoeulermusic
    @bernardoeulermusic 2 года назад

    mannn, thanks a lot for showing this method Array from, i was struggling with HTML Collections

  • @revizion9101
    @revizion9101 7 месяцев назад +1

    Great video ive been struggling so much with this concept as ive been using the odin project and in their js course they keep linking to articles that provide examples for all the basics of js but they use these damn selectors and DOM manipulation in their examples which has made learning js 100x harder than its needed to be so this video is a huge help

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

      Brooo, I’m in the same situation, I love the Odin project but Mann these damn dom manipulation. How is it going now for you?

  • @DevsLikeUs
    @DevsLikeUs 3 года назад

    Great list

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

    I love you, thanks a lot !

  • @focusme-tv3650
    @focusme-tv3650 3 года назад

    Hi ! Just wanted to check if I knew everything about traversing, so classic check up. I do, but god your video was just extremly clear and pleasant to listen to. I subscribed ! =D
    By the way, for the beginners, the main difference between "parentElement" and "parentNode" methods is that the first one returns an HTML collection, which is kind of an array storing ONLY elements, while the second returns a nodeList, which returns all the parent nodes. Nodes can contain elements but also text / comment etc. ... So it's not a weird behavior but more a very specific method that we, as web developers, need to take in consideration.

  • @abhishekbevinal7495
    @abhishekbevinal7495 3 года назад

    thank u so much bro,,lv from india,,tq tq so much ,,

  • @DioneMohammed
    @DioneMohammed 3 года назад

    Thanks man ✌

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

    deserve my sub!!

  • @fortemmusic
    @fortemmusic 2 года назад

    Thank you sir

  • @augischadiegils.5109
    @augischadiegils.5109 3 года назад

    Thanks man :)

  • @samermazraani9011
    @samermazraani9011 2 года назад

    this is a great video