DEV Community

Discussion on: JavaScript Cheatsheet from beginners to advance..

Collapse
mrdanielschwarz profile image
Daniel Schwarz

You beat me to it!

However, document.querySelector("#foo") instead of document.querySelectorAll("#foo") should do fine since there shouldn't be duplicates of IDs anyway.

Collapse
mightycoderx profile image
MightyCoderX

Just use getElemenyById('foo') for elements with 'foo' id

Collapse
lukeshiru profile image
LUKESHIRU

Indeed! That's a bad copy/paste of mine.