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

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

  • January 20, 2021
  • 5 replies
  • 192 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

Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • January 21, 2021

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.


  • Author
  • January 21, 2021



Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • January 21, 2021

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


  • Author
  • January 21, 2021



Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • January 22, 2021

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.