Welcome to the Treehouse Community
Looking to learn something new?
Why do you have to use "form span" and not "p span"?
I wanted to try and perform the code this way: ''' $("p span").hide(); ''' ''' <form action="#" method="post"> <p> <label for="username">Username</label> <input id="username" name="username" type="text"> </p> <p> <label for="password">Password</label> <input id="password" name="password" type="password"> <span>Enter a password longer than 8 characters</span> </p> <p> <label for="confirm_password">Confirm Password</label> <input id="confirm_password" name="confirm_password" type="password"> <span>Please confirm your password</span> </p> <p> <input type="submit" value="SUBMIT"> </p> </form>
''' But it did not work. I don't understand why.
Steven Parker215,984 Points
It looks like it should work.
For the code you show here, it should work either way because all the paragraphs are inside the form. But if any paragraphs containing spans were added outside the form it would no longer be the same.
For that reason, and because it also makes the intention clear, the use of "
form span" as the selector would be a better choice.
If you'd like a more accurate and complete analysis of why it's not working, make a snapshot of your workspace and post the link to it here.
Note: when quoting code, the 3 marks are accents (```), not apostrophes (''').