Disabling rows in a matrix | XM Community
Skip to main content
Solved

Disabling rows in a matrix

  • April 11, 2024
  • 2 replies
  • 58 views

Forum|alt.badge.img+2

I want to disable selected rows in a matrix.

@TomG helped me out on something similar. 

However I want to rewrite the code to disable selected rows (say row 1 & 2) in column 1

jQuery(".c4 input[type='text']").prop("disabled",true); 

 

Best answer by TomG

@mugheeshay,

If the rows aren’t randomized, you can do it by position:

var column1 = jQuery(".c4 input[type='text']");
var disableRows = [1, 2];
jQuery.each(disableRows, function(i,row) {
column1.eq(row-1).prop("disabled",true);
});

 

2 replies

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 6083 replies
  • Answer
  • April 11, 2024

@mugheeshay,

If the rows aren’t randomized, you can do it by position:

var column1 = jQuery(".c4 input[type='text']");
var disableRows = [1, 2];
jQuery.each(disableRows, function(i,row) {
column1.eq(row-1).prop("disabled",true);
});

 


Forum|alt.badge.img+2
  • Author
  • Level 2 ●●
  • 10 replies
  • April 11, 2024

@mugheeshay,

If the rows aren’t randomized, you can do it by position:

var column1 = jQuery(".c4 input[type='text']");
var disableRows = [1, 2];
jQuery.each(disableRows, function(i,row) {
column1.eq(row-1).prop("disabled",true);
});

 

Legend