How can I delay a question from appearing? | XM Community
Solved

How can I delay a question from appearing?

  • 11 November 2017
  • 5 replies
  • 466 views

Userlevel 4
Badge
Is there a way for me to delay a question from appearing? I have a video that I would like the respondent to watch for 30 seconds before a question appears right below it on the same page.
icon

Best answer by AnthonyR 14 November 2017, 19:15

View original

5 replies

Userlevel 7
Badge +7
Add the following JavaScript to the question you would like a delayed:

Qualtrics.SurveyEngine.addOnload(function()
{
this.getQuestionContainer().hide();

});

Qualtrics.SurveyEngine.addOnReady(function()
{
var delayTime = 30000 //This is the time of delay
var that = this;
setTimeout(function(){that.getQuestionContainer().show()}, delayTime);

});

The timing can be updated by updating the value of delayTime, which is set in milliseconds.
Userlevel 4
Badge
Perfect! Thank you!!
Badge +3

This is a great answer.
I've tried delaying a slider question. However, the problem is that when the slider appears (after 20 seconds) the slider is "cut". It looks as if the values had been reduced to 0-1, while the slider is set to be 0-100. The problem disappears when I remove the javascript code (above).
Is there a way to have the code "show" the entire slider (instead of cutting it)?
Thank you!
Two images to clarify:
With delay (in JS) what appears is:
image.pngWithout delay (in JS):
image.png

Userlevel 7
Badge +27

Hi Marta , if you still need, I was able to get the slider to display okay after the delay by using the below:
var q="#"+this.questionId;
jQuery(q).css("content-visibility","hidden");
setTimeout(function () {
jQuery(q).css("content-visibility","visible");
},5000);

Badge +3

Thank you, Tom!

Leave a Reply