How do I hide a column in a matrix table using JavaScript? | XM Community
Solved

How do I hide a column in a matrix table using JavaScript?

  • 8 August 2020
  • 1 reply
  • 186 views

Userlevel 4
Badge +14
  • Level 5 ●●●●●
  • 133 replies

I've used the code below to hide individual cells in a row in a constant sum matrix table.... and when I hide every cell in a row, the whole row is hidden.
However, I'm now trying to hide a whole column. I can hide every cell apart from the header text for the column... I've tried using different row values (I've used inspect to try and determine the row number of the header).
var that = this.questionId;
var row = 0;
var column = 6;
jQuery("#"+that+" .ChoiceRow:eq("+(row+0)+") .c"+(column-1)+"").css({"pointer-events":"none","visibility":"collapse"}); */repeat for each cell in row*/
Is there an easier way to hide the whole column in a Matrix table (constant sum with total)?

icon

Best answer by TomG 10 August 2020, 15:10

View original

1 reply

Userlevel 7
Badge +27

jQuery("#"+this.questionId+" .c4").hide();
Where c4 is the 1st column, c5 the 2nd column, etc.

Leave a Reply