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! While you're at it, check out some resources Treehouse students have shared here.
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 trialJustin Sze Wei Teo
9,418 Points$("form span") selector okay without mentioning intermediary 'p' element?
Hi,
For the selector used , i.e. "form span" , why is it that 'p' is not mentioned and this works? Isn't the span a child of the paragraph <p> element, which is then in turn the child of the form?
Does this imply it is ok to skip a few childs to point at which element we're selecting?
Kindly advise, thanks!
1 Answer
Benjamin Barslev Nielsen
18,958 PointsYes, "form span", just means the span needs to be inside a form tag, the form does not need to be the parent of the span. However, if you use the selector:
form > span
span needs to be a child of a form element.
Justin Sze Wei Teo
9,418 PointsJustin Sze Wei Teo
9,418 PointsThanks! Clear now