Skip to content
Discussion options

You must be logged in to vote

Hi @afine1927, my approach to this would be to do two things each time a button is clicked (i.e. inside the click event handler):

  1. disable/hide the button that was just clicked
  2. check if all buttons are the page are disabled/hidden, and if so, then end the trial.

The second bit of code you provided shows how to grab all of the button elements and loop over them. So to do the second step above, then inside the loop you'd just be checking if any of the buttons are disabled/hidden - something like this:

// this goes inside your the click function for your buttons
// first disable/hide the button that was just clicked, then:
var all_clicked = true; 
var btns = document.querySelectorAll('.jsps…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@stecion
Comment options

@becky-gilbert
Comment options

@stecion
Comment options

@becky-gilbert
Comment options

Answer selected by jodeleeuw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants