Welcome to the Treehouse Community
Looking to learn something new?
Justin Sze Wei Teo9,418 Points
$("form span") selector okay without mentioning intermediary 'p' element?
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!
Benjamin Barslev Nielsen18,958 Points
Yes, "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.