Ok, cool, thank you. :)

Glen

On Nov 27, 2007 12:35 PM, David Serduke <[EMAIL PROTECTED]> wrote:

>
> This won't work for every javascript library of course but for jQuery
> I believe you can use the internal .data() functions to find the
> handlers.
>
> http://docs.jquery.com/Internals/jQuery.data#elem
>
> var elem = $("a").get(0);
> var handlers = jQuery.data(elem, "events") || {};
> var clicks = handlers["click"];
> for (var h in clicks) {
>  clicks[h].call(elem);
> }
>
> that I think (totally untested) would call all the event handlers
> attached by jquery.  Dunno if it helps but it was interesting looking
> in to it. :)
>
> David
>
> On Nov 27, 9:44 am, "Glen Lipka" <[EMAIL PROTECTED]> wrote:
> > I have a script that decorates all links with an extra tracking click
> > handler.
> > First version:  $("a").click()...
> >
> > However, I would also like to find elements that have an onclick handler
> > already on them.
> > Second version: $("a,[onclick]").click
> >
> > But how could I detect all elements that have onclick handlers, even if
> they
> > were added after the fact using a javascript library?
> >
> > Thanks,
> >
> > Glen
>

Reply via email to