Deselecting other checkboxes if one is selected | XM Community
Skip to main content
Solved

Deselecting other checkboxes if one is selected

  • September 19, 2019
  • 4 replies
  • 242 views

Suppose I have a checkbox style question - "What fruits do you like?" and the options are: * Apples * Bananas * Oranges * Unsure I want to try and implement two functionalities: 1. In case the user selects "Unsure", then I'd want the other checkboxes to be deselected 2. If afterwards the user deselects "Unsure", then the selections made previously should reappear I need to necessarily figure out a way to implement (1). (2) would be a nice-to-have, but not wholly needed. Follows is the code, wherein I tried to implement this: jQuery("#QID10-4-label").click(function(){ if(jQuery("#QID10-4-label").hasClass("q-checked")){ //This will be implemented if the user has selected option 4 jQuery("#QID10-1-label").prop("q-checked", false); jQuery("#QID10-2-label").prop("q-checked", false); jQuery("#QID10-3-label").prop("q-checked", false); } else { //This will be implemented if the user has deselected option 4 //Ideally I'd want to be able to reselect those options which had been previously selected if any } }); Any help on this would be much appreciated. Thanks!

Best answer by VirginiaM

@avikram you can actually do this without custom code. Write out the question, right click on the "Unsure" answer choice and choose "Make answer exclusive". See screenshot:!
View original

4 replies

VirginiaM
Level 4 ●●●●
Forum|alt.badge.img+49
  • Level 4 ●●●●
  • 183 replies
  • Answer
  • September 19, 2019
@avikram you can actually do this without custom code. Write out the question, right click on the "Unsure" answer choice and choose "Make answer exclusive". See screenshot:!

  • Author
  • 6 replies
  • September 23, 2019
Sorry for the late reply. Thanks! This works.

Forum|alt.badge.img
  • 1 reply
  • March 29, 2024

Hello, I know this was a while ago, but… 

I made a date picker out of multiple choice questions (question is the day, choices are the hours) and this Q&A was very helpful, given participants can now choose only one option per day, but I want to make it one question per block. Is this possible?


courtrc
Level 3 ●●●
Forum|alt.badge.img+9
  • Level 3 ●●●
  • 53 replies
  • March 28, 2025

@Flavia did you figure it out?

If not, I didn’t quite understand what you were asking/trying to implement with “one question per block”. Can you elaborate?


Leave a Reply