On Sep 14, 2007, at 1:08 AM, Roland wrote:

>
> Hi there,
>
> Events can be attached multiple times to the same element.. is there a
> way to prevent this?
>
> Something like ...
>
> if(!$(el).hasEventAttached()) Event.observe($(el), 'click',
> function());

If this is what you *really* need (and I'd suggest you may have a  
design problem if you think so), then don't use Event.observe-- 
instead, attach the handler directly:

// Not tested
var f = function (e) { ... }.bindAsEventListener(someObject);
if (el.onclick != f) {el.onclick = f;}


TAG


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to