function keypressCheck() { var keyID = event.keyCode; //space pressed if (keyID == 32) { anotherFunction(); } }
I want
It should work. Just to make sure, try this:
function keypressCheck(e) { var e = window.event||e; // Handle browser compatibility var keyID = e.keyCode; //space pressed if (keyID == 32) { e.preventDefault(); // Prevent the default action anotherFunction(); } }