Hello,
I'm looking to clear selected options when the respondent clicks the 'back' button.
It seems that the choices are 'labels' on Qualtrics back end.
I realize that when the option is selected, there is a new 'q-checked' class that is added. Hence I've been looking for ways to remove that class following the various suggestions here (html - Remove CSS class from element with JavaScript (no jQuery) - Stack Overflow), but it doesn't seem to work.
See one example screen capture below.
There always seems to be a TypeError, something like: "Cannot set properties of null (reading classList)"
Could somebody please help?
Many thanks in advance!
Solved
How to clear selected options when user uses back button
Best answer by StephH72
Hello,
Here's some javascript which unselects all choices when the page is hit. So if they select some options then click the back button then this code will clear those options when they reach that page again, forcing them to re-complete the question. Hope this helps!
Qualtrics.SurveyEngine.addOnReady(function()
{
this.setChoiceValue(1,false)
this.setChoiceValue(2,false)
this.setChoiceValue(3,false)
this.setChoiceValue(4,false)
this.setChoiceValue(5,false)
})
I set it for 5 options but you can add more by just changing the number.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.

Thanks so much in advance!