In an example where eq() function is used, it was used as eq(“+index+”)
I haven’t seen syntax like this before. What does “+” sign on both sides mean? How is it different from eq(index)?
Thank you!
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.
In jQuery,
eqrefers to two slightly different things:.eq, the function, and:eq, the selector.The function version is chained onto a jQuery object, so you’d see examples like:
Whereas the other form is used as part of the selector string, so you’ll see people concatenate the index with the rest of the string:
For performance reasons (and better readability in many cases), the jQuery documentation recommends the first form, the
.eqfunction.