This is an old revision of the document!
Table of Contents
formatLikertMatrix - Improve usability of a Likert matrix in a variety of ways
The formatLikertMatrix function formats a likert matrix question by formatting the columns by percentage and enabling better control of repeat headers. It also optionally supports adding a divider line before the last column, adding mobile labels, and hiding selected cells.
Functionality includes:
- Format columns based on percentage width of label/statement column
- Reliably switches to and from mobile accordion mode
- Controls display of repeating headers display when carry forward or display logic is used
- Controls vertical alignment of repeating headers
- Add 'NA' column divider line and adjust scale labels accordingly
- Display scale labels in mobile accordion mode
- Hide specified cells
Set-up Instructions
Survey Header
To make the function available to all questions in the survey, copy the function to the Survey Header inside a script tag:
Add the formatLikertMatrix function to the survey header to make it available to any question in the survey. Go to Look & Feel → General → Header edit →
and paste the provided formatLikertMatrix function JS:
<script>/*Paste formatLikertMatrix function JS here*/</script>
Alternatively, paste the formatLikertMatrix function JS into a question's JS outside the existing Qualtrics functions to make it available to questions on the page.
Multiple Choice Question
Question Settings
Set the following single choice Likert Matrix options:
- Check Mobile Friendly
- Check Transpose if needed.
- Uncheck Position Text Above
- Select Repeat Headers options as needed. All Repeat Header options are supported.
Question JavaScript
Add JS to call the formatLikertMatrix function to apply it to the Likert Matrix question as follows:
Qualtrics.SurveyEngine.addOnload(function() {
formatLikertMatrix(this);
});
To override the default options, specify the desired options in the second function argument as an object. For example:
Qualtrics.SurveyEngine.addOnload(function() {
formatLikertMatrix(this,{});
});
Options
labelsBottom
labelsBottom specifies whether scale labels should be repeated on the bottom. Set to true to turn on bottom labels
Default: false
