Hello all,
How can I hide the multiple choice buttons for my questions? I have added some JS code so participants can respond using key presses so I don't want participants to answer by mouse-clicking on the buttons on the screen.
I have tried variations of the following code but haven't been able to make it work - could someone kindly help me with this?
Many thanks in advance!
Qualtrics.SurveyEngine.addOnload(function()
{
this.hideNextButton();
this.hidePreviousButton();
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);
that.clickNextButton();
var v = document.getElementsByClassName('MultipleAnswer');
for (i = 0; i < v.length; i++) {
v[i].style.visibility = "hidden";
}
}
});
});
Best answer by ahmedA
View original