Delayed autoadvance javascript | XM Community
Skip to main content

I’m seeking clarification/a modification to previous posts on auto advancing. I’d like to put an autoadvance but sometimes it feels quite immediate, and a few response options are long enough that people on mobile may click on one just to scroll down and find a better answer. So I’d like an autoadvance with a two second delay after clicking. What’s the javascript modification needed? Thanks in advance

 

@TomG, you answered one of the auto advance posts last time. Care to chime in? 

 

Auto-advance single choice MC with 2 second delay:

Qualtrics.SurveyEngine.addOnReady(function() {
this.hideNextButton();
var qobj = this, to;
qobj.questionclick = function(event,element){
if (element.type == 'radio') {
clearTimeout(to);
to = setTimeout(function() { qobj.clickNextButton(); },2000);
}
};
});

 


You can apply delay on auto click using jQuery delay function. in the below code 1 second =1000 milliseconds. you can calculate and update the delay time accordingly.

jQuery("#NextButton").css('display','none');
this.questionclick = function(event,click){
if (click.type == 'radio') {
clearTimeout(this.clickNextButton().delay( 1000 ));
}
};

 

 

 

 


Leave a Reply