index = 5;
alert($('ul li:eq(index) a',context).html());
This script will alert : "Null", but when I change to:
alert($('ul li:eq(5) a',context).html()); // it works
So what is wrong with this script?
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.
You need to use the variable value, not the
indexstring…A lot more readable and little faster version is:
If
contextis a DOM node:If
contextis a jQuery object: