On 12 mai, 23:09, huy <[email protected]> wrote:
> The onChange event is working correctly. The problem is when I hold
> down the up/down key and an onChange event occur for every item
> selected. I just want to fire the event for the last item selected
> when the key is let go. I tried adding a keyboard listener and
> removing the changelistener when key is down and adding it back when
> key is up. The problem with that is I'm missing the last event. Any
> help is appreciated, thanks.
You might want to use the "blur" event instead...
(I'd rather say you'd have to live with it though... maybe start a
timer on change, cancelling and restarting it if onchange happens
before the timer fires, and only do your "on change" logic in the
timer)
Have a look at
http://www.slideshare.net/pp.koch/voices-that-matter-javascript-events
(starts at slide 79; note that the behaviour you describe is only true
of IE and Opera; Firefox and Safari will only fire the change event on
blur)
Have a look at this too (a bit more technical, 40% overlap)
http://www.slideshare.net/pp.koch/yahoo-1337458
and http://yuiblog.com/blog/2009/04/27/video-ppk-jsevents/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---