I have a button and the following javascript routine.
$("button").keydown( function(key) {
switch(key.keyCode) {
case 32: //space
return false;
}
} );
as I understood it, the return false;
would stop the keypress from being processed. So $("button").click();
would not be called. For other keyCodes this works as expected. For example if I intercept40
, which is the down button, the page is not scrolling.
I noticed this behaviour in firefox.
Why does the return false;
does not stop the button click event on space? What does the javascript spec say about this?