jQuery.fn.multiselect = function() { (function(){ var count=0; $(this).parent().click(function(){ count=count+1; }); })(); }