This works :
alert(document.getElementById("Container").nodeName);
But this doesnt :
var CurParent = document.getElementById("Container");
alert(CurParent.nodeName);
I am using IE7.
Why ?
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.
From your latest comment, this seems to be an issue with variable scoping. Are you sure that the var
parentis really global? The following will not work, due to improper variable scope:Define a variable in the largest scope where you intend to use it. The following will work.