JS for adding vertical line to matrix | XM Community
Skip to main content

Hi all, I am not well-versed in JS. However, I found some JS code online to add a vertical line to the qualtrics matrix, e.g., to set apart the "NA" option from other options (see code here: https://gist.github.com/marketinview/cd5d385d8803124078a0
This code works for me when I implement it, but it stops working when I enable the "repeat headers" option. Any help on how to adapt the JS code so that it works with the "repeat headers" option enabled? Code is below:
Qualtrics.SurveyEngine.addOnload(function() {
var q = jQuery("#"+this.questionId);
var cl = q.find('td.ColumnLabels:first');
if(cl.length > 0) cl.attr('colspan', cl.attr('colspan') - 1);
if(q.find('div.desktop').length > 0) q.find('.last').css("border-left", "1px solid #BBBBBB");
});

I wrote that code and it works for me when repeat headers is enabled. Can you post a picture and specifics on your matrix configuration options?


https://community.qualtrics.com/XMcommunity/discussion/comment/54912#Comment_54912Hmmm it started working after I walked away and came back an hour later. Strange how various features of the survey seem to update at different speeds. Thank you for your JS code, it is very handy!


Leave a Reply