Hello everyody!
I know very little about Java Script, but I need to add a custom code to my survey that makes pressing the spacebar continues the survey in the "Text/Graphic" question type. I need your help, please! Thanks in advance
AnaCa
You can include the below code in the Javascript section of Text/Graphic question. It will go to the next page. Post that if you want to auto advance to different question types you can enable it from Look and feel section.
Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/
var qid=this.questionId;
document.onkeydown = function(event) {
console.log('keydown',event);
if (event.which == 32) {
jQuery('#NextButton').click();
}
}
});
Hope it helps!
Thank you so much, Deepak! The code you sent works perfectly!
Of course you have to publish the survey (I only say this in case there is someone else with the same doubt and do what I did). I first was trying to see if it worked only with the Preview and it didn't work well (obviously ), but once you publish the survey it works perfectly.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.