Code and Testcase at jsbin
Basically, $("#div-pmdialog span") seems to select all SPANs on the page, whereas my understanding was that it should find only those SPANs which are descendants of $("#div-pmdialog"). What am I doing wrong?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Your HTML isn’t parsed as you expect. The DOM inspector says it gets parsed as:
HTML isn’t XML. In HTML4 and older, self-closing tags was a no-op, mostly because browsers simply ignored the slash. I believe HTML5 specifies that some tags may be “self-closed”, but only those that may never have any content, like
<img>or<br>.