Skip to content

Instantly share code, notes, and snippets.

@marketinview
Last active October 31, 2023 12:47
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marketinview/c941fc59b7ddaef8ba3b to your computer and use it in GitHub Desktop.
Save marketinview/c941fc59b7ddaef8ba3b to your computer and use it in GitHub Desktop.
Qualtrics: Change NPS Scale. This script changes the scale of an NPS question from 0-10 to a smaller scale. 1-10 is most common, but any scale can be specified. For numbered horizontal scales, the NPS question type is preferable to a horizontal multiple choice because it remains horizontal on small screen mobile devices. #qualtrics #js #jq #nps …
Qualtrics.SurveyEngine.addOnload(function() {
//Thomas Gibbons Consulting
//Change NPS question scale
var scaleStart = 1; //Change - 0 or more and no greater than end
var scaleEnd = 10; //Change - 10 or less and no less than start
//No changes below
var width = 100/(scaleEnd - scaleStart + 1) + "%";
var q = jQuery("#"+this.questionId);
var cc = q.find('td.ControlContainer');
q.find('td.LabelContainer').each(function(index) {
if(index<scaleStart || index>scaleEnd) {
this.hide();
cc[index].hide();
}
else {
this.setAttribute('width', width);
cc[index].style.width = width;
}
});
});
@marketinview
Copy link
Author

Instructions:

  1. Add JavaScript to question.
  2. Set scaleStart and scaleEnd to desired values.

@marketinview
Copy link
Author

marketinview commented Nov 14, 2017

See additional Qualtrics solutions at: https://qualtricswiki.tgibbons.com/doku.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment