I've had some help from the forum, and I wanted to share my code. This allowed me to create a multiple choice question, auto select an answer, and hide the question's answers from the participants. (I just deleted the "question" field and put a space in so it would not display). NOTE: I had to select the choice to "Display answers in a random order" because this code does not include randomizing.
The magic of this code is that instead of endless survey flow with the same blocks repeated several times each with different words for one little part, I could have one set that I put in piped choices for. I hope this serves someone well!
This first bit of code allowed me to hide the answers. I did it this way because another way caused the question and answers to flash for a brief moment instead of never appearing:
Qualtrics.SurveyEngine.addOnload(function () {
this.getChoiceContainer().hide();
});
This next bit is what chose the answer for the participants automatically:
Qualtrics.SurveyEngine.addOnReady(function () {
var $this = jQuery(this.questionContainer);
$this.hide();
var $choices = jQuery(".QuestionBody .ChoiceStructure .LabelWrapper label[for]", $this);
var randomChoice = Math.floor(Math.random() * $choices.length + 1) ;
jQuery(".QuestionBody .ChoiceStructure .LabelWrapper label[for]:eq(" + randomChoice + ")", $this).click();
});
JS: Auto-select Random Question and Hide from Participants
Sign up
Already have an account? Login
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login to the Community
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
