Welcome to the Treehouse Community
Looking to learn something new?
Ben Os20,008 Points
How to connect id and class in document.querySelector ?
Say I want to target an element that has BOTH id and class with querySelector, to later manipulate it,
How can I target the element with this combination?
Owa Aquino19,277 Points
I think there's no way doing this in the query selector and even in your css style sheet.
And if ever it's possible this would be a bad practice.
The purpose of using ID selector is selecting a single element that is unique, while using Class selector is selecting multiple elements with the same qualities. By selecting both ID and Class at the same time it would be difficult for the browser to select a specific elements, it will always return multiple elements (if somehow it's posible to select both Class and ID in the query selectors).
This is only my opinion though, Hope this helps.