Qualtrics更改NPS Scale

2024-09-24
#Java

在线问卷 Qualtrics 更改 NPS 问题的度(默认0到10,改为1到7),用以下 JavaScript 代码:

Qualtrics.SurveyEngine.addOnload(function() {
    //Thomas Gibbons Consulting
    //Change NPS question scale (not simple layout)
    var scaleStart = 1;         //Change - 0 or more and no greater than end
    var scaleEnd = 7;           //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;
        }   
    }); 
});

延伸阅读