Forum Moderators: open

Message Too Old, No Replies

OnKeyUp Fires Twice

Update on this error...

         

devonreed

11:42 pm on Sep 6, 2006 (gmt 0)

10+ Year Member



I discovered this problem while testing on Safari, and found a workaround. Since I found a lengthy discussion of the problem here, I thought I'd share a partial solution.

While

document.getElementById('x').onkeyup = foo;

may get you the double click problem,

bar = {};
bar.onkeyup = function(event) { do something };
document.getElementById('x').onkeyup = bar.onkeyup;

seems to be a satisfactory solution.

Not sure of the reasons...

DrDoc

8:28 pm on Sep 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Any specific keys which causes it to fire twice, or does it happen all the time?

orion_rus

6:47 am on Sep 26, 2006 (gmt 0)

10+ Year Member



do you return false on a function?

whoisgregg

8:16 pm on Sep 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think this is related to the bug in Safari, "Redundant keydown, keypress, keyup events sent for arrow keys [bugzilla.opendarwin.org]"

We've talked about it here a couple [webmasterworld.com] times [webmasterworld.com] before.

Thanks for giving us an update on a workaround devonreed! :D