Could someone help me with my JavaScript code?
In question QID4, I have a gender selection question. If someone chooses 'Prefer not to say,' I'd like to automatically select '1. Terminate on the next page.
I wrote JavaScript code, but no matter which option I choose in QID4, it always auto selects option 2, 'Continue.
Qualtrics.SurveyEngine.addOnload(function() {
var gender = "${q://QID4/ChoiceGroup/SelectedChoices}";
if (gender === "4") {
this.setChoiceValueByRecodeValue(1, true);
} else {
this.setChoiceValueByRecodeValue(2, true);
}
});