What is the querySelector Method in JavaScript? | Document.querySelector() Explained

preview_player
Показать описание
In JavaScript, the 'querySelectorAll' method allows you to retrieve a list of Elements that match the CSS Selector that you specify. Essentially, it is a way of finding Elements in JavaScript. It's quitee flexible and lets you search for tags, classes, IDs, parent/child combinations, attributes and so on.

In this video I show you a clear and simple example of how it works on the 'document' object as well as another Parent Node - to only search within that parent.

For your reference, check this out:

Follow me on Twitter @dcode!

If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!
Рекомендации по теме
Комментарии
Автор

Writing a comment to help, since you helped me, big ups to creators like you for helping other learn!

SolidJello
Автор

I realise this video is now 3 years old, but thanks for producing such a well-explained tutorial for this function!

CazCreates
Автор

Crystal clear explanation..Keep it up!

vijay
Автор

how goods it hearing an Aussie accent showing stuff on Youtube!! keep em coming!

Scottyhutch
Автор

Thank you so much for your videos. They are highly appreciated, even after 4 years!

damianbilgi
Автор

thank you for this!!! informative, concise, and straightforward

meiyu
Автор

hey mate, good to hear an Aussie in a tutorial, keep it up. Do you do courses?

cloudpuncher
Автор

idk English very well, but i understood it clearly, thank you :)

compot
Автор

Great video. Watched several others about this topic. Only after yours I got the thing., thx.

jakemao
Автор

Thanks. This helped with a hamburger menu jumplink for my website.

Trunk
Автор

gives back the CSS selector in the console output section (right side)

danteeep
Автор

Good lesson. You helped me, thnx a lot. Hi from Ukraine =)

Pegasfps
Автор

Thank you so much.Your videos are quiet good!

AtillaRustemli
Автор

Ok any advantages over 'getElementBy..'?

jgsk
Автор

You are a master of the explanation... a huge thank you :)

atanasdambov
Автор

Excellent explanation! Thank you so much for this helpful video.

ErikNonIdle
Автор

Hi, do you know why QuerySelectorAll() is only working in the first web site? i try other website in the same project or katalog but works only on 1 site even i import the link and script correctly

mrmantn
Автор

can we use vararivel name in document. quesry selector. i want to check whehter radio buttons are checked or not
for(i=1;i<=tot;i++){


}

tanvirhussain
Автор

Thank you! You're awesome for this!

noxsweet
Автор

container2 could be directly accesed without making
"const container2".

shubham-ldrl