Preventing double-clicks in jQuery/Ajax-y handlers

on Monday, August 22, 2011
Throwing this out there to see what people thing--I suspect there are better, cleaner ways to do this, and I'm wondering what they are.
$.fn.click1 = function(fn) {
$(this).data('clicked', false);
$(this).click(function(o) {
if ($(this).data('clicked')) return false;
$(this).data('clicked', true);
fn(o);
return false;
});
};

(I return false because I know I don't

0 comments:

Post a Comment