2008-11-19 16 views

cevap

9

hasEvent() eklentisine bir göz attınız mı? Kod oldukça küçük:

(function(A) { 
    A.fn.hasEvent = function(C) { 
     var B = this.data("events"); 
     return(B && B[C]) 
    } 
}) (jQuery) 

özel bir amaç için size hafifçe değiştirebilir:

(function($) { 
    $.fn.hasEvents = function() { 
     return new Boolean(this.data('events')); 
    } 
}) (jQuery); 

$('#someDiv').click(function() { 
    alert('new event'); 
}); 

$('#someDiv').hasEvents();  // true 
$('#someOtherDiv').hasEvents(); // false 
İlgili konular