Whenever I used jQuery for client side code, I created a separate function for the event handler, so I could detach it later. But now, I discovered event namespace, which helps prevent unnecessary declarations; it will allow you to specify a namespace whenever attaching to an event, and will also allow you to remove all handlers for that namespaces.
So, you can write code like
$("a.button").on("click.myButtonNamespace", function() {
//do stuff here
//unbind
$(this).off("click.myButtonNamespace");
});
Have a look at the jQuery docs for event namespaces.