Reputation: 13
For 30 Qualtrics pages, I'm using the code below (which I borrowed from here) to for each page:
Qualtrics.SurveyEngine.addOnload(function()
{
$('Buttons').hide();
if(window.location.pathname.match(/^\/jfe[0-9]?\/preview/)) {
$(this.questionId).select('input').first().focus();
}
var that = this;
Event.observe(document, 'keydown', function keydownCallback(e) {
var choiceID = null;
switch (e.keyCode) {
case 74: // 'j' was pressed
choiceID = 1;
break;
case 75: // 'k' was pressed
choiceID = 2;
break;
}
if (choiceID) {
Event.stopObserving(document, 'keydown', keydownCallback);
that.setChoiceValue(choiceID, true);
$('NextButton').click();
}
});
});
To the best of my knowledge this code has been used by other users.
The problem however is that the "Next" button is hidden only on the first page. From the second page onward the "Next" button is always displayed although the rest of the code works fine.
Any idea where the problem is?
Best,
Upvotes: 0
Views: 429
Reputation: 5004
It's a timing issue due to changes in Qualtrics since that post. Change addOnload to addOnReady.
Upvotes: 2