If I assign a handler to the OnClick event of an element twice, the handler will be executed twice. But I want to change this so even if I assign it twice, the handler will only execute one time.
Nonsensical example to demonstrate issue:
$('.button').click(
function(){
alert('here');
});
$('.button').click(
function(){
alert('here');
});
So I've added the handler twice. Now when I click an element with that class, I'd get two alert boxes.
The question is, how do I restrict it so I would only get one alert box?