Hi everyone,
I'm trying to implement a feature where users can unselect a radio button in a single select question by clicking on it again. Currently, users can only select a different option, but not unselect the selected option.
I've tried using the following code in the "Single Question JS" section of the question, but it doesn't seem to be working:
this.questionclick = function(event, element) {
if (element.type == 'radio') {
var selectedOption = this.getSelectedChoices()[0];
if (selectedOption === element.getAttribute('value')) {
this.clearChoice(element);
}
}
}.bind(this);
Is there a better way to do this, or am I missing something in my code?
Thanks in advance for your help!