[jQuery] Re: cancel jQuery binded event handlers
> Exactly. Does any body know how can I reach jQuery created event > object in first handler. I think this could be a solution... Event delivery order is an implementation detail so you can't be guaranteed which will fire first. However, if the a4j handler is set by the time .ready() fires you could do something like this: $(document).ready(function(){ // select the element... var a4jclick = element.onclick; element.onclick = null; $('element').click(function(e){ // do what you need to here... if ( a4j_event_handler_should_run && a4jclick ) return a4jclick.call(this, e); return whatever... }); });
[jQuery] Re: cancel jQuery binded event handlers
> Having both inline and bound event handlers will always cause > confusion. true, but onclick inline handler is appended by a4j framework, which I can't influence :( The only thing I can do is to append guard to that handler, like in the first example. > You could use event.stopImmediatePropagation in the first handler, but > unfortunaly that is only available through jQuery-added listeners > (1.3.1). Exactly. Does any body know how can I reach jQuery created event object in first handler. I think this could be a solution...
[jQuery] Re: cancel jQuery binded event handlers
Having both inline and bound event handlers will always cause confusion. You could use event.stopImmediatePropagation in the first handler, but unfortunaly that is only available through jQuery-added listeners (1.3.1). On Jan 29, 5:42 pm, 1nd1go wrote: > Hi all, > > I am trying to cancel event propagation in handler I have defined in > the following manner: > > element.onclick = fuction() { /* first handler */ } > > I have also defined handler with jQuery: $('element').click( function() > { /*second handler*/ } ) > > So the point is I want to prevent invocation of second handler and do > this only in first handler. > > I can't call element.unbind() method in first handler, because it will > do this forever. I need to discard invocation for concrete case which > I check in first handler. > > Any help will be appreciated!