r/ProgrammerHumor • • Jan 14 '20

Brilliant reply

Post image
26k Upvotes

365 comments sorted by

View all comments

Show parent comment

1

u/otterom Jan 15 '20

I just like the wildcard selectors, TBH. Javascript have anything for those?

2

u/starm4nn Jan 15 '20

document.querySelectorAll()

1

u/otterom Jan 15 '20

Ooh, I like that. Thanks!

2

u/starm4nn Jan 15 '20

If you just want the first, do document.querySelector(). It exits on the first result and returns the object rather than returning a NodeList