hasEvent

Download    JQuery.hasEvent is my first plugin for the JQuery JavaScript library. It is a small & simple plugin that accepts a string as its only argument. The plugin will return true if the element that it has been called on contains that event.

For example, say you have a Div with the id "example_div":

<div id="example_div">Click Me</div>


Now you bind an event to it:

$('#example_div").bind('click', function() {
    alert('
Clicky clicky!');
});


Finally let's say you want to bind another click event, but only if there is no click event currently present, you could do this with the following method:

var $element = $('#example_div');
if (!element.hasEvent('click')) {
    $element.bind('click', function() {
        alert('No other clicky!');
    });
}

JQuery.hasEvent has been tested with JQuery 1.2.6.
Download JQuery: http://docs.jquery.com/Downloading_jQuery
Download hasEvent: http://plugins.jquery.com/project/hasevent