How to hide radio button element in matrix question | XM Community
Solved

How to hide radio button element in matrix question

  • 5 November 2018
  • 9 replies
  • 191 views

Hello!

I am struggling with hiding radio button element in Qualtrics. I have a transposed matrix question, and I am trying to hide some specific radio buttons.

I was trying to use below codes:

<code>$('QR~QID392~5~14').hide(); </code>

<code>$('QR~QID392~5~14').style.visibility = 'hidden';</code>

However none of them is working. Would be grateful for any advice!
icon

Best answer by TomG 6 November 2018, 09:59

View original

9 replies

Hello @Piotr ;

Use following code `jQuery("[id='QR~QID392~5~14']").hide();`

But in order to hide qualtrics radio button, we need to use td tag's class to target.
Hi Shashi,

Thank you for the prompt answer. I have been trying to use this code in Javascript functionality:

<quote>
Qualtrics.SurveyEngine.addOnload(function()
{
jQuery("[id='QR~QID392~5~14']").hide();
});
</quote>

However it doesn't work for me. I am not sure if I am using it correctly, or I should use it in CSS code? And if it comes to those tag's class, where I can find it? Sorry if my questions are dummy, I am learning this on the run. 🙂
Userlevel 7
Badge +27
Hide the contents of a matrix cell:
```
var cell = "5~14";
jQuery(("#QR~"+this.questionId+"~"+cell).replace(/~/g, "\\\\~")).closest("td").find("*").hide();
```
@TomG Works perfectly! Thanks a lot.
Userlevel 7
Badge +33
@TomG , This code is hiding the button but when i click on this are i am able to proceed.
Userlevel 7
Badge +27
> @PeeyushBansal said:
> @TomG , This code is hiding the button but when i click on this are i am able to proceed.

In my example above, disable the input before hiding the cell.
```
var cell = "5~14";
var input = jQuery(("#QR~"+this.questionId+"~"+cell).replace(/~/g, "\\\\~"));
input.prop("disabled",true);
input.closest("td").find("*").hide();
```
Badge
Hi there,
I have a similar quesiton regarding hiding the middle button of a bipolar scale. Although I have successfully managed to hide it some time ago, now, rather unexpectedly, it seems that it does not work. Any idea about how to solve the problem?
The JS code for a simple bipolar question with three options in which I am trying to hide the middle button is as follows:

Qualtrics.SurveyEngine.addOnload(function()
{
var cell = "1~2";
jQuery(("#QR~"+this.questionId+"~"+cell).replace(/~/g, "\\\\~")).closest("td").find("*").hide();
});

I thank you for your cosnideration.
Badge +1

Hey I came across this question related to something I’m working on. I’m representing a five-point satisfaction Likert item with emoji. I would like to make the emoji clickable (with a highlight indication  around the selected emoji showing the respondent they have selected that choice) and hide the radio button. Is this the way to do that? 

 

Also, a general question (for custom coding learners like myself): Where exactly do I put the accepted answer in my Qualtrics interface?

Userlevel 7
Badge +27

@AbeB,

Put the accepted answer in the question’s addOnload function.

Leave a Reply