jQuery click events firing multiple times
.unbind()
is deprecated and you should use the .off()
method instead. Simply call .off()
right before you call .on()
.
This will remove all event handlers:
$(element).off().on('click', function() {
// function body
});
To only remove registered 'click' event handlers:
$(element).off('click').on('click', function() {
// function body
});
To make sure a click only actions once use this:
$(".bet").unbind().click(function() {
//Stuff
});