"The onchange event is fired before the ?event? happens."

One question.. What is the second ?event? you mention ?






________________________________
De : Eric Pascarello <[email protected]>
À : [email protected]
Envoyé le : Mar 7 décembre 2010, 22h 12min 29s
Objet : Re: [JSMentors] Re : Re : Re : Not triggering an onchange handler

Trying to do anything with the click events is too late. The onchange event is 
fired before the event happens.

You would need to handle the logic inside of the onchange handler to see what 
element has focus. Only issue is browsers set document.activeElement 
differently 
so it is not as easy to see if that element is your button/link.

Eric






On Tue, Dec 7, 2010 at 11:40 AM, Stephane Eybert <[email protected]> wrote:

Hi Christophe,
>
>Thanks for your comment, I must say I tried to have some return false in the
>method as
>
>
> $('.no_style_keyboard_letter').click(function(event) {
>   typeTextIntoFocusedElement($(this).attr("letter"));
>
   return false;
> });
>
>but no luck.
>
>Same with
>
><a href="javascript:typeTextIntoFocusedElement('&#224;');return false;"
>title='$caption'> &#224; </a>
>
>I admit I shot in the dark here.
>
>I own all the code so I could re-architect it if needed.
>
>I shall keep trying.
>
>Thanks again.
>
>Stephane
>
>
>
>
>
>----- Message d'origine ----
>De : Christophe Porteneuve <[email protected]>
>À : [email protected]
>Envoyé le : Mar 7 décembre 2010, 15h 38min 14s
>Objet : Re: [JSMentors] Re :  Re : Not triggering an onchange handler
>
>
>OK, preventing the event from being fired.  Actually you don't care about its
>being fired (and it WILL be), but about its being DETECTED.
>
>Depends on your browser.  If you don't have to support IE, you can capture that
>event and censor it when appropriate.
>
>You likely DO have to support IE, however, so the question is more about "who's
>paying attention?".  If it's done at a higher level in the DOM (some ancestor
>element, perhaps document itself), then just listen for it closer to the source
>field (perhaps the field itself) and censor its bubbling when appropriate
>(jQuery would have your function return false to do this; the W3C standard, and
>Prototype's preferred way as well, is to call the event object's
>stopPropagation() method; etc.)
>
>If you already have event listeners in place straight on the field, well, I
>don't know of a way to prevent those from getting triggered on field change
>(which, as a reminder, only happens on blur for text fields).
>
>'HTH
>
>-- Christophe Porteneuve
>[email protected]
>
>_______________________________________________
>JSMentors mailing list
>[email protected]
>http://jsmentors.com/mailman/listinfo/jsmentors_jsmentors.com
>
>
>
>
>
>_______________________________________________
>JSMentors mailing list
>[email protected]
>http://jsmentors.com/mailman/listinfo/jsmentors_jsmentors.com
>



      
_______________________________________________
JSMentors mailing list
[email protected]
http://jsmentors.com/mailman/listinfo/jsmentors_jsmentors.com

List Archive:
http://jsmentors.com/pipermail/jsmentors_jsmentors.com/

Reply via email to