I've lost hours by trying to implementing javascript code that auto-advances to next question once any choice was made on a single-choice question. I've found several code-snippets like
var qobj = this;
jQuery("#"+this.questionId+" input[choiceid=1]").click(function() { qobj.clickNextButton(); });
jQuery("#"+this.questionId+" input[choiceid=2]").click(function() { qobj.clickNextButton(); });
jQuery("#"+this.questionId+" input[choiceid=3]").click(function() { qobj.clickNextButton(); });
or this (very generic) one:
jQuery("td").click(function(){
setTimeout(function() {
jQuery("#NextButton").click();
}, 10);
});
Both snippets are working: if a participant clicks an answer, he is moved to the next question.
But as soon as another single-choice question is in line in the survey flow, this question seems to be affected by the automatism as well and gets immediately "skipped" without having time to make a choice!
Any help on this is desperately appreciated!
I guess there's a reason why you are not using the off-the-shelf auto-advance functionality?
(Look & Feel -> Motion -> Autoadvance on questions / pages)
I can't use auto-advance for all pages, because the feature is only needed in dedicated questions. So a custom code is necessary.
I managed it by using this code
Qualtrics.SurveyEngine.addOnReady(function() {
/*Place your JavaScript here to run when the page is fully displayed*/
var that = this;
var answers = $$(".SingleAnswer");
for (var x = 0; x < answers.length; x++) {
answers[x].observe('click', function(event) {
that.clickNextButton();
});
}
in addition to a timed question.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.