Sometimes, the keyboard should be used: for instance, in laboratory studies for navigating the questionnaire or to exclude participants from a study for methodological reasons if they do not have a keyboard.
JavaScript can directly react to inputs in the questionnaire and also to a keypress via the “keyup” event. The following HTML/JavaScript code hides the “Next” button but allows navigation to the next page by pressing the spacebar (keyCode 32).
<script type="text/javascript"> // Hide the "Next" button SoSciTools.submitButtonsHide(); // React to the "keyup" event window.addEventListener("keyup", function(e) { if (e.keyCode == 32){ SoSciTools.submitPage(); } }); </script>
You can find the KeyCodes for other keys listed on numerous websites or test them directly at https://www.toptal.com/developers/keycode.