Hiding checkbox in slider question | XM Community
Solved

Hiding checkbox in slider question

  • 23 August 2019
  • 3 replies
  • 18 views

Hi Everyone,

I have a rating scale question where I'd like the N/A option to be available for some options but not others. So far I've managed to hide the N/A label using:
document.getElementById("QID14-7-NA-label").style.visibility = "hidden";

However, I tried the same code using the checkbox ID but the checkbox remains (see attached image). Any ideas?

Thanks!
Cathy

!
icon

Best answer by NiC 23 August 2019, 18:46

View original

3 replies

Userlevel 7
Badge +27
Hi @Cathyday

We can easily hid the NA option with the following code:
`jQuery("div.q-slider").children().children().eq(2).children("div.statement-container").children("div.n-a-container").hide();`

you can change the number in "eq(2)" to based on its position of the slider you want hide NA.
Here is a preview link of survey where i have added the above code:
https://ugamsandbox.ca1.qualtrics.com/jfe/preview/SV_4GczFcC8vgtT57T?Q_SurveyVersionID=current&Q_CHL=preview
Thanks @NiC, that did the trick perfectly!

hi NiC thanks for your suggestion. However, is it possible to apply to the scenario of just hiding N/A option in multiple statements?

For my case, I have 7 statements in slider question but I just want N/A option for one of my statements. I have tried to apply this javascript to hide the other 6 statements. Let's say, I just want to show "N/A" option for my 5th statement, so I have added the following javascript by hiding the NA option in statement 1-4 and 6-7.
jQuery("div.q-slider").children().children().eq(1).children("div.statement-container").children("div.n-a-container").hide();
jQuery("div.q-slider").children().children().eq(2).children("div.statement-container").children("div.n-a-container").hide();
jQuery("div.q-slider").children().children().eq(3).children("div.statement-container").children("div.n-a-container").hide();
jQuery("div.q-slider").children().children().eq(4).children("div.statement-container").children("div.n-a-container").hide();
jQuery("div.q-slider").children().children().eq(6).children("div.statement-container").children("div.n-a-container").hide();
jQuery("div.q-slider").children().children().eq(7).children("div.statement-container").children("div.n-a-container").hide();

However, it does not work properly. May I know how to solve this? Thanks so much!

Leave a Reply