Well, the question is in the title. Is there any difference (performance, caveats) between multiple selector
jQuery("selector1, selector2")
and adding elements to selection with add:
jQuery("selector1").add("selector2")
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.
Yes, the first will create a jQuery object that contains elements matched by both selectors. The second will create an object that has elements matched by the first selector, then create and return a new object with both, without modifying the first object.
For example: