I've implemented this javascript for certain slides so participants can view the next slide by pressing the spacebar:
Qualtrics.SurveyEngine.addOnload(function() {
var qid = this.questionId;
document.onkeydown = function(event) {
console.log('keydown',event);
if (event.which == 32) {
event.preventDefault();
jQuery('#NextButton').click();
}
}
});
The code works great, a little too great.
Once I've implemented the code, the spacebar can be used to submit a page for every slide thereafter, including slides where I've delayed the appearance of the next button (to force participants to view an image for 6 seconds). On these pages, the clever participant will figure out they can simply press the spacebar and avoid viewing the image for the allotted time.
The spacebar code even continues to work in new blocks without reapplying the code.
Is there a means of disabling the keyboard for slide, disabling the spacebar, or mandating the 6 second viewing period (other than using the auto-advance feature)?
I have tried to use literally every related solution currently available in these forums. Any insight would be AMAZING.
Page 1 / 1
Problem Solved!
Applying the following code fixes the issue.
document.onkeydown = function(event) {}
Solution found at:
https://community.qualtrics.com/XMcommunity/discussion/12321/how-to-disable-a-keypress-event
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.