Given a Javascript DOM object, what is the most idiomatic way of calling a jQuery function on it? Currently, I am using:
$('#' + object.id).someFunction()
However, this doesn’t feel quite right. Isn’t there a better way?
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.
This should work
You can see it live here: http://jsfiddle.net/XsKXU/
See this documentation for reference on the
$(akajQuery) function