I'm creating a web front end to control a small robot. Ajax calls will be made on a keydown, to start the robot, and keyup to stop it.
My problem is that when a key is held down the keyup, keydown, and keypress events seem to cycle continually. Does anybody know of a way to only have keydown fire when the key is first pressed and keyup to fire when it has been released?
--edit: I forgot to mention it originally but I have tried saving the state of the button. The problem is that keydown, keypress and keyup events fire over and over again as I am holding the key down.