If this event is no longer used for this event, you can use the .one() method instead of .on to get this functionality.
$(document).ready(function(){ var favorites = []; var counter = 0; $('.containers').one('click', function(){ favorites.push($(this).clone()) $('.favorite').append(favorites); }); });
http://jsfiddle.net/9Dmcg/4/
Even if there were more, you could use .one() :
$(document).ready(function(){ var favorites = []; var counter = 0; $('.containers').one('click', function(){ favorites.push($(this).clone()) $('.favorite').append(favorites); $(this).on("click",function(){ alert("Favorite Added!"); }).triggerHandler("click"); }); });
http://jsfiddle.net/9Dmcg/5/
source share