var click_count =[]; jQuery.fn.multiselect = function() { var List = this; $(this).parent().click(function(){ var Num = List.index($(this)); if(!click_count[Num])click_count[Num]=0; click_count[Num]++; }); } $('.element').multiselect();