I have a javascript function which runs when the 'down' key is pressed. I would like, that if the 'down' key is held down, the function would not run at all.
I thought about timing between keydown and keyup, if the time is less than 1 second then the function would run on keyup. The problem is, if I hold the key down the browser sees it as the key being pressed many times in succession.
Is there a better way to do this?
Thanks
keydown
event fires (but not if it's already set), and unset it whenkeyup
fires? – Meghanmeghann