When JQuery binded or lived events are triggered multiple times

var clicked = function(){
alert('clicked')
}
$(".click").live("click",clicked);

The “clicked” function could be triggered multiple times in certain circumstance.
But one solution to this is to remove the binded event before binding/live it, sth like:

$(".click").die("click").live("click",clicked);

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s