I don’t know what it is called but can anyone direct me to a tutorial or something which will enlighten me on how to address HTML DOM elements in jquery??
For Example, I want to know the difference between $('#someid div') or $('#someid > div').
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.
jQuery uses CSS selectors for addressing HTML elements. Read the jQuery documentation on its selectors (api.jquery.com/category/selectors) to know the details.
The difference between the selectors you mentioned is following:
#someid divgets you alldivelements located inside element with ID=someid,#someid > divgets you alldivelements located inside element with ID=someid, but not enclosed in different elements located in element with ID=someid– that means that thedivelements have to be “childs”, not just “descendants” of the element with specified ID,So, the second selector is more specific and the first one is broader.
More on “child selector” is in the documentation.