Hi everyone. I just want to preface this by saying I am a student and I have no previous experience with JavaScript.
For my survey I am currently using this code to register key presses as radio button clicks and auto-advance to the next question.
Qualtrics.SurveyEngine.addOnload(function()
{
var qobj = this;
jQuery(document).keypress(function(event) {
var key = event.key.toUpperCase();
if(key == "J" || key == "F") {
jQuery(this).trigger ("click");
if(key == "J") qobj.setChoiceValueByRecodeValue(1,true);
if(key == "F") qobj.setChoiceValueByRecodeValue(2,true);
document.getElementById("NextButton").click();
}
});
});
My question is: now that participants can select options using key clicks what code could I use to hide the radio buttons so the whole survey looks more clean.
Solved
Hide All Radio Buttons with Custom Code
Best answer by ahmedA
Just add this line to your JS:
this
.getQuestionContainer()
.querySelectorAll("[class^='q-']")
.forEach(button => button.hide());
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
