How to hide a radio button on a single select question? | XM Community
Question

How to hide a radio button on a single select question?

  • 20 January 2021
  • 5 replies
  • 124 views

I would like to temporarily hide all the radio buttons of a question for 10 seconds. After these 10 seconds, I want to show all (four) radio buttons except the third one, which must remain hidden.
Now hiding all the radio buttons for 10 seconds is not a problem, because that worked. The problem is that all the radio buttons show up after 10 seconds, while I want them all to show up except the third one. Below you can find the JavaScript of this question. I hope you can help me with this.


5 replies

Userlevel 7
Badge +21

Add this code to your question JS. It hides the last radio button, but should also work for checkboxes.
Qualtrics.SurveyEngine.addOnload(function(){
ch = this.getQuestionContainer().querySelectorAll("[class*=q-]");
ch[ch.length-1].hide();
});

You can repeat the last line to hide multiple buttons. JS indexing starts from zero, so if you want to hide the first button, it will be

ch[0].hide() 
similarly, the second last option would be
ch[ch.length-2].hide()
and so on.


Userlevel 7
Badge +21

I'm sorry. I don't understand the problem that you are facing? Also, what is the jQuery code doing in the middle?


Userlevel 7
Badge +21

This is a different question from what is stated in your title. Please ask a separate question for this or edit your title and initial question. This will make it easier to find the solution.

Leave a Reply