I've a bad-programmed library which is doing this

$(document).on('click','#keep_first_only_button', function(){

I wrote, after this, a piece of code to 'override' this bad behaviour

$("keep_first_only_button").unbind("click");
$("keep_first_only_button").on("click", selectKeepFirstOfAll);

BUT this is not working, then document.click function handler is triggered again

I cannot unbind all click events from document, because disasters will happen in the page.

Which is the right way to proceed in this situation?

EDIT: Sorry for time loosing question, I didn't see the missing '#' in my selector. I'm really sorry !

Edit
Report