Adding withdarw button | XM Community
Skip to main content
Solved

Adding withdarw button

  • October 9, 2023
  • 2 replies
  • 225 views

Forum|alt.badge.img+2

I have added java script, to have a withdraw button at the end of each page. The purpose is that if participants want to withdraw from the study, they can click the button. When participants click the buttons, a question with three options should come up. The withdraw button shows up at the bottom of each screen, but it's not clickable and doesn't pop up the question.

I have added the following code:

Qualtrics.SurveyEngine.addOnload(function() {
$(this.question._$separator).hide();
$(this.questionId).hide();
var that = this;
var endBtn = document.getElementById("EndNow");

function skip() {
    that.setChoiceValue(1, true);
    that.clickNextButton();
};

endBtn.addEventListener("click", skip);
});

Best answer by rondev

Make sure you are adding the button first and then adding events on it.

2 replies

Nam Nguyen
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+29
  • QPN Level 8 ●●●●●●●●
  • 1096 replies
  • October 9, 2023

@zaink This is only the JS, what’s your button looks like. Are you adding the button code at footer?


rondev
Level 6 ●●●●●●
Forum|alt.badge.img+22
  • Level 6 ●●●●●●
  • 1450 replies
  • Answer
  • October 10, 2023

Make sure you are adding the button first and then adding events on it.