Any way to add an observer to the head of the queue using Element#observe?

Posted by Josh on Stack Overflow See other posts from Stack Overflow or by Josh
Published on 2010-05-06T20:04:54Z Indexed on 2010/05/06 20:08 UTC
Read the original article Hit count: 203

Filed under:
|
|
|
|

This might not be possible but before I rewrite part of my application I wanted to ask...

I have a JavaScript app which creates a submit <input> and observes that input's click event using Prototype's Element#observe function. For a few particular pages on one particular site which uses this app, I need to apply some additional business logic before the code which executes normally when the button is clicked.

Is there any way I can use Elemen#observe to add my new event handler before the existing event handler, so I can stop the event if these new conditions aren't met? If not I'll probably solve this the "proper" way by having the application fire a specific beforeTakingAction event and add a listener for that which prevents the application from taking it's action, but that's more complicated than this simple problem requires, and requires rewriting part of a shared application for just one user...

© Stack Overflow or respective owner

Related posts about prototypejs

Related posts about JavaScript