Skip to content
Discussion options

You must be logged in to vote

So I've done this in the end with the following code in the html-slider-response file:

document.addEventListener('keydown', key_listener)
    function key_listener(e){
      if(["1","2","3","4","5","6"].includes(e.key)){
        display_element.querySelector('#jspsych-html-slider-response-response').value = e.key
        display_element.querySelector('#jspsych-html-slider-response-next').disabled = false;
      } else if(e.key==="Enter" && display_element.querySelector('#jspsych-html-slider-response-next').disabled === false){
        display_element.querySelector('#jspsych-html-slider-response-next').click()
      }
    }

The event listener can be removed in the 'next' button click list…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by becky-gilbert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant