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?
This should work
$(object).someFunction();
You can see it live here: http://jsfiddle.net/XsKXU/
See this documentation for reference on the $ (aka jQuery) function
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With