Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Uche Onuekwusi17,314 Points
If i only selecting elements by id, tags and class and do not use document.query selector in developing programs.
If i only select elements by id, tags and class and do not use document.query selector in developing programs. does this make me a bad developer ?
Jennifer NordellTreehouse Teacher
Hi there, Uche! It absolutely does not make you a bad developer. In fact, using
querySelector has a bit of parsing of the DOM going on under the hood which makes it slightly less performant than the others. So if you simply need something to select the id "my-div", it's going to be faster to
getElementById('my-div') than the corresponding
querySelector. However, you might have a really tricky DOM selection sometimes that requires that you select 3 or 4 things to finally get down to the thing you are after. If that is the case, a
querySelector might make your code a bit more concise.
Hope this helps!