Are the following exactly equivalent? Which idiom do you use and why?
$('#form1 .edit-field :input') $('#form1 .edit-field').find(':input') $('.edit-field :input', '#form1') $(':input', '#form1 .edit-field')
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.
I would use either #2 or #4:
Both of the above are essentially the same. Behind the curtain when you specify a context this is what’s happening anyway:
The reason I would avoid #1 and #3 is because they’re both significantly slower than #2/#4.
EDIT: Just did a quick test: 1000 input elements using YOUR selectors: