Regarding Java script | XM Community
Skip to main content

I have 50 choices in a matrix question, which I need to show alphabatically and I am using below java script code but its not working. Please help, how can I get is resolved. Its a multiselect matrix question -

Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/

var mylist = jQuery('tbody > tr > th');

var listitems = mylist.children('th').get();

listitems.sort(function(a, b) {

 return jQuery(a).text().toUpperCase().localeCompare(jQuery(b).text().toUpperCase());

});

for (var i=0; i < listitems.length; i++) {

mylist.appendChild(listitemssi]);
}

});

Be the first to reply!

Leave a Reply