Solved
Deselecting a radio button
I am working on a Qualtrics question with radio buttons. There is a condition where I need to deselect an already selected radio button. It seems that a class named 'q-radio' changes to class named 'q-radio q-focused q-checked' is applied to the radio button when it is selected. Thus, the radio button attributes like checked and disabled aren't working. Is there a way by which I can deselect the radio button using javascript or JQuery?
Best answer by srane
Well, I have realized a mistake that I was making previously. The solution given by @mattyb513 works perfectly. The only thing that needs to be done is that 'this.questionID' needs to be stored in a variable first.
Code:
var qid = this.questionId;
Qualtrics.SurveyEngine.registry[qid].setChoiceValue(5, 1, false); //This statement deselected the 1st radio button of 5th row
Thanks!
View originalCode:
var qid = this.questionId;
Qualtrics.SurveyEngine.registry[qid].setChoiceValue(5, 1, false); //This statement deselected the 1st radio button of 5th row
Thanks!
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.