Is there a potential pitfall in using jquery on/off method and trigger to execute on non-dom elements/regular js objects.
thanks
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.
No, you can use
.onand.offon regular objects, as long as you keep in mind that it will add additional properties to the object.I must ask though, in what situation does it make sense to bind events to an object? why not just give the object a method that you can call?