Use data('events') to search for event handlers:
var isBound = function(el, ev) { var found = false; $.each($(el).data("events"), function(i, e) { if (i === ev) { found = true; } }); return found; } if (!isBound(selector, 'focus')) { $(selector).bind('focus', fn); }
I think you can use the .one() function in jQuery too, see http://api.jquery.com/one/
source share