I have a question, Q139, that is shown on my survey as shown in the image below:
I would like to add Javascript so that (1) the "Next" button remains as "Next" if "Yes" is selected for Q139 and (2) the “Next” button changes to read "Submit" if "No" is selected for Q139.
I have basic Javascript knowledge, and with the help of Google Gemini, I am trying to use the following code but it is not working:
Qualtrics.SurveyEngine.addOnReady(function() {
const nextButton = jQuery('#NextButton');
const yesResponse = "${q://QID139}";
jQuery("#QID139").on("change", function() {
if (yesResponse === "No") {
nextButton.attr("title", "Submit").val("Submit");
} else {
nextButton.attr("title", "Next").val("Next");
}
});
});
Does anyone know what I am doing wrong?