Alas, previous ones would ignore inline event handlers.

(function($){
$.fn.hasEvent = function(evt){
   return !!($.data(this[0],"events")[evt]||this['on'+evt]);
};
})(jQuery);

or

$.expr[':'].event = function(a,i,m){
   return !!($.data(a,"events")[m[3]]||a['on'+m[3]]);
};

On Jan 15, 7:18 pm, Ricardo Tomasi <ricardob...@gmail.com> wrote:
> (function($){
> $.fn.hasEvent = function(evt){
>    return !!$.data(this[0],"events")[evt];};
> })(jQuery);
>
> (only works for a single element)
>
> $('#id').hasEvent('click');
>
> You can make that into a selector if you want:
>
> $.expr[':'].event = function(a,i,m){
>    return !!$.data(a,"events")[m[3]];
>
> };
>
> $('#id:event(click)')
>
> $('#id').is(':event(click)')
>
> cheers,
> - ricardo
>
> On Jan 15, 2:24 pm, KidsKilla <kidski...@gmail.com> wrote:
>
> > hi everyone!
> > is there any possibility to find out if there is event binded to the
> > element?
>
> > some kind of $("#id").is(":event(click)")
>
> > now i'm using $("#id").is("[onclick]"); but it don't works if event is
> > binded with jQuery

Reply via email to