Meaningless Drivel is fun!*
The moose likes HTML, CSS and JavaScript and the fly likes onkeydown before onchange event Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "onkeydown before onchange event" Watch "onkeydown before onchange event" New topic
Author

onkeydown before onchange event

Luke Zechariah
Ranch Hand

Joined: Sep 27, 2005
Posts: 117
I have onkeydown event and a onchange event for a drop down list. The problem is that if a user has to type "jww", the moment they type "j" the onchange event is triggered. Is there way the onchange event can be delayed till the onkeydown event is completely finished.

Thank you for your reply in advance.
Luke
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Only choice you will have is use onblur or add a setTimeout to the onchange delay the firing and use cancelTimeout.

Eric
Luke Zechariah
Ranch Hand

Joined: Sep 27, 2005
Posts: 117
Eric, thanks that was a very quick reply. Here is my code, I am not good at javascript can you let me know what to add please:



Thank you,
Lk.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
look at this:
http://www.manning-sandbox.com/thread.jspa?threadID=14781&tstart=0

You may want to cancel the timeout with the onkeypress

Eric
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: onkeydown before onchange event