Jquery/Javascript to uncheck all items in a matrix question | Experience Community
Skip to main content
Solved

Jquery/Javascript to uncheck all items in a matrix question

  • Dec 21, 2021 3:46 PM UTC
  • 3 replies
  • 182 views

Forum|alt.badge.img

I will say my jQuery/JavaScript is rusty, but the Qualtrics naming and usage has me stumped. I have a two-column matrix question that allows the R to select one or both. I am being asked to create a second question with a check box that (if checked) would uncheck all of the entries in matrix.
Q1 Visited Stayed
Park 1 ___ ___
Park 2 ___ ___
Park 3 ___ ___

Q2
___ I did not visit or stay in any of these parks

Normally, I would put this in the matrix, but the request is to split it out. In the JavaScript for Q2: How do I reference (and set) the boxes accordingly? Is there a best practice for this type of situation? Any sample code would be appreciated.

Best answer by TerryP

I was able to figure it out. It didn't appear that the checkbox below the matrix was able to use the prop. Using .jQuery('QR~QIDn-1').prop('checked', false);  worked.

View original

3 replies

rondev
Level 6 ●●●●●●
Forum|alt.badge.img+22
  • Level 6 ●●●●●●
  • Dec 24, 2021 4:39 PM UTC

Yes, we need to add two click events, one for each question's (Matrix and multi select question) checkboxes. Check the demo here.


Forum|alt.badge.img
  • Author
  • Jan 14, 2022 4:48 PM UTC

rondev - Hmm. I was actually looking for code that would do this.


Forum|alt.badge.img
  • Author
  • Answer
  • Jan 14, 2022 6:54 PM UTC

I was able to figure it out. It didn't appear that the checkbox below the matrix was able to use the prop. Using .jQuery('QR~QIDn-1').prop('checked', false);  worked.