Hi Everyone,
I would like a reminder to pop up when a respondent is clicking the “Next Button” after filling out a text field in my survey. Next, if the person clicks “cancel” I would like the respondent to *stay on the page*, and otherwise progress to the next question.
Weirdly, all that I described works if the question is placed at the very beginning of the survey, but not if it is placed in between other questions further down. Does anyone have an idea what the issue could be?
Here’s the code I am using:
Qualtrics.SurveyEngine.addOnReady(function() {
// Add an event listener to the Next button
var nextButton = document.getElementById('NextButton');
nextButton.addEventListener('click', function() {
if (confirm("In case you would like to share your message with your co-workers, please make sure you copied the message from the text field. Do you want to move on to the next page?") == false) {
event.preventDefault(); // Prevent the default action of moving to the next page
event.stopPropagation(); // Prevent the event from propagating to other click listeners
event.stopImmediatePropagation(); // Prevent any additional click listeners from executing
}
});
});
Thanks a lot!
Best,
Chantal