I'm using JS code to make each cell in column in a matrix table read only - see below...
jQuery("#QR\\\\~QID90\\\\~13\\\\~1").prop("readonly",true);
jQuery("#QR\\\\~QID90\\\\~4\\\\~1").prop("readonly",true);
jQuery("#QR\\\\~QID90\\\\~6\\\\~1").prop("readonly",true);
I realized from inspecting the cells during the survey that the id changes during the survey, so I updated the code to below to cater for each loop:
jQuery("#QR\\\\~1\\\\~QID90\\\\~13\\\\~1").prop("readonly",true);
jQuery("#QR\\\\~1\\\\~QID90\\\\~4\\\\~1").prop("readonly",true);
jQuery("#QR\\\\~1\\\\~QID90\\\\~6\\\\~1").prop("readonly",true);
jQuery("#QR\\\\~2\\\\~QID90\\\\~13\\\\~1").prop("readonly",true);
jQuery("#QR\\\\~2\\\\~QID90\\\\~4\\\\~1").prop("readonly",true);
jQuery("#QR\\\\~2\\\\~QID90\\\\~6\\\\~1").prop("readonly",true);
However, this still didn't work. What am I doing wrong? FOUND THE ISSUE - WAS MISSING AN UNDERSCORE - SORRY
But, if there is an easier way to make a whole column read only (rather than one cell at a time) that would be good to know.
Solved
JavaScript in Loop & Merge
Best answer by TomG
Yes:
jQuery("#"+this.questionId+" .c4 input").prop("readonly",true);
It is rarely necessary to use element ids to find elements.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.