A quick question.. what’s the JAVASCRIPT statement to get the immediate children of a LIST? I tried:
document.getElementById(id).getElementsByTagName('li');
which gives me all of the child nodes.
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.
loop through:
document.getElementById(id).childrenand get the ones that are li elements (I think they should all be according to spec)
I think
document.querySelectorAll('#id>li')if it is supported should work as well. See:http://www.w3.org/TR/selectors-api/