I'd go with a hybrid of RaYell's and phoenix's solution, adding jQuery's namespacing to the mix:
$('#addlink').bind('click.killlink',function(event){
event.preventDefault();
// You can do any additional onClick behavior here
});
To unbind this event, as well as any other related events (of any type) that you group with the .killink namespace, you'd run this:
$('#addlink').unbind('.killlink');
As phoenix pointed out, using return false
will prevent the event from bubbling up. preventDefault()
has the added benefit of being extremely explicit (unlike return false
, which can mean many different things depending on the context).