Hiding withdraw/exit survey button (footer) from select Qualtrics pages using Javascript | XM Community
Skip to main content
Hi everyone-



I'm looking for a way to hide a Qualtrics footer (which is set up to function as an 'I would like to exit this survey' button) on select pages. For background, the footer is using the following code (found on one of these discussion threads I believe, and without the # symbols):



<#button id= "EndNow" name="EndNowBtn" title="EndNow" type="button">I would like to exit this survey#</button>



I'm getting the button to work as I would like by adding questions at the end of pages that are hidden by Javascript (found on the same thread):



Qualtrics.SurveyEngine.addOnReady(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);

});



I'm using an 'End of Block' Skip Logic on these questions and directing to customised End of Survey messages through the Survey Flow, all done to ensure ethical requirements from the university are met. For the most part, this is working well.



The problem, however, is that there are a few other questions that have Skip Logic, as participants need to be screened for eligibility. These questions are automatically on a page of their own, and try as I might, I cannot add one of the Javascript questions onto them to ensure the button still works correctly, as the hidden question is then also automatically given its own page. Meaning the survey now has pages on which the button doesn't work, or worse, somehow serves to get participants to the next page rather than exiting them out of the survey as indicated by the button.



Is there any way to hide the footer (button) on these pages / Skip Logic questions that allows me to avoid the problem of a dysfunctional button?
Add this JS to one of the questions on a page where you want to hide the button:

```

Qualtrics.SurveyEngine.addOnReady(function() {

jQuery("#EndNow").hide();

});

```
Thank you so much, that completely solves the problem! Really appreciate your help to a JS newbie like myself.
Is it also possible to hide the button on an "end of survey" page? How would I do that?



Thank you!
> @MadelineC said:

> Is it also possible to hide the button on an "end of survey" page? How would I do that?

>

> Thank you!



Yes, edit the End of Survey library message in html mode, and put the script above in a `<script>` tag.
This is what I have written in html mode and it is not working...am I doing something wrong?



"<Qualtrics.SurveyEngine.addOnReady(function()

{

jQuery("#EndNow").hide();



});>



This is the end of the survey. Thank you very much for your time!"
> @MadelineC said:

> This is what I have written in html mode and it is not working...am I doing something wrong?

>

> "<Qualtrics.SurveyEngine.addOnReady(function()

> {

> jQuery("#EndNow").hide();

>

> });>

>

> This is the end of the survey. Thank you very much for your time!"



Assuming your button has the id EndNow, it should look like this:

```

<script>

Qualtrics.SurveyEngine.addOnReady(function() {

jQuery("#EndNow").hide();

});

</script>

This is the end of the survey. Thank you very much for your time!

```
I am adding an "ethical" exit survey button at the bottom of each page of my survey, using a one line "Exit Survey" (this is of course not the whole code line) code and it works, but it takes the participant to the Qualtrics website. How can I redirect the button to go to the "Debrief" file that I have at the end of the survey for people who complete the survey.
Continued from my past post.....I am pretty sure I have to change the location in #location.href='https://www.qualtrics.com/# part of the code, but I don't know what the path to my library is. I have set the "Survey Termination" under "Options" to the file in my library.
> @Mitra said:

> Continued from my past post.....I am pretty sure I have to change the location in #location.href='https://www.qualtrics.com/# part of the code, but I don't know what the path to my library is. I have set the "Survey Termination" under "Options" to the file in my library.



I don't think you'll be able to link to the End of Survey message in your library. You could make a replica of it, then upload it as a file to your library and link to the file. Something like:

https://yourbrand.co1.qualtrics.com/WRQualtricsControlPanel/File.php?F=F_xxxxxxx
> @TomG said:



> I don't think you'll be able to link to the End of Survey message in your library. You could make a replica of it, then upload it as a file to your library and link to the file. Something like:

> https://yourbrand.co1.qualtrics.com/WRQualtricsControlPanel/File.php?F=F_xxxxxxx



Thank you Tom. It seems to be working now.

Leave a Reply