jQuery click events firing multiple times
Solution 1:
To make sure a click only actions once use this:
$(".bet").unbind().click(function() {
//Stuff
});
Solution 2:
.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
});