This delegate event is firing twice (not always, sometimes).
client.bindButtonClickFunction = function(){
$("#client-plugin").delegate(".client-button", "click", function()
{
var id = this.id.split('-')[2];
client.retrieveMessageByID(id);
});
};
I call the function after inserting all the ".client-button"'s.
Any thoughts on how to stop it? I tried event.stopPropagation(), and also undelegating and re-delegating to no avail.
This is in Chrome, as part of a Chrome plugin.
Depending on how you register the delegate, you might want to do:
$("#client-plugin").undelegate('event').delegate('event', ...)
Also, try to add a return false
from your handler.
You need to stop immediate propagation
$("#client-plugin").on(".client-button", "click", function (e) {
e.stopImmediatePropagation();
var id = this.id.split('-')[2];
client.retrieveMessageByID(id);
});
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