I have the following code:
function someMethod()
{
$(obj).click(function {});
}
someMethod is called twice and thus click event is bound twice. How can I make it bind only once?
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.
If you can apply it, probably want to take a look at event.preventDefault and event.stopPropagation
OR unbind and bind each time, within your method like