2008-11-19 8 views

Respuesta

9

echas un vistazo al plugin hasEvent()? el código es bastante pequeña:

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

para su propósito específico podría modificar ligeramente:

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

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

$('#someDiv').hasEvents();  // true 
$('#someOtherDiv').hasEvents(); // false 
Cuestiones relacionadas