Table of Contents
starRating - Add rating descriptions to Stars slider
The starRating function adds ratings descriptions (e.g, Very Poor, Poor, Average, Good, Excellent) to a Stars Rating question.
Functionality includes:
- Works with any number of stars
- Supports both full star and half-star ratings
- Flexible and translation-friendly specification of ratings labels
Here is a quick video demonstration:
This function is available for a reasonable fee. Contact TomG on the Qualtrics Community to learn more.
Set-up Instructions
Survey Header
Add the starRating 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 starRating function JS:
<script>/*Paste starRating function JS here*/</script>
Alternatively, paste the starRating function JS into a question's JS outside the existing Qualtrics functions to make it available to questions on the page.
Slider Question
Question Settings
- Slider type: Stars
- Star interaction: Discrete or Half Step
Question JavaScript
Add JS to call the starRating function to apply it to the Slider question as follows:
Qualtrics.SurveyEngine.addOnload(function() { starRating(this); });
To change the default options, specify the desired options as an object. For example:
Qualtrics.SurveyEngine.addOnload(function() { starRating(this,{ratings:"starRatings"}); });
Options
ratings
ratings is used to specify the rating descriptions (aka labels). It is either an array or a string. If ratings is an array, it contains the rating label text strings. If ratings is a string, it specifies the html class of a hidden, unordered list in the question text that contains the rating labels. For example:
<ul style="display:none" class="starRatings"> <li>Very Poor</li> <li>Poor</li> <li>Average</li> <li>Good</li> <li>Excellent</li> </ul>
The number of ratings labels must be appropriate for the number of stars. If the number of stars is n and the star interaction is Discrete
, the number of rating labels must be n or n+1. If the number of ratings labels is n+1, the first string will be displayed when zero stars are selected. If star interaction is Half Step
, the number of rating labels must be n*2 or (n*2)+1.
Default: ["Very Poor","Poor","Average","Good","Excellent"]