admin管理员组文章数量:1122846
I want to set up a question in qualtrics in which input on one slider changes the value on another slider, but not to a constant sum. In specific, the first slider should take an input (0-1) and the slider below should adjust to 1-(1-input)^2.
Currently, my code looks like this:
Qualtrics.SurveyEngine.addOnload(function() {
var currentQuestionInfo = this.getQuestionInfo()
var postTag = currentQuestionInfo.postTag
var currentQuestionID = this.getQuestionInfo().QuestionID;
var Sli1Old = 1;
var Sli2Old = 1;
var DomSli = 0;
var respSli1 = document.getElementById(currentQuestionID + '~1~result');
var respSli2 = document.getElementById(currentQuestionID + '~2~result');
Event.observe(document, 'mouseup',function(e){
var currentResponse1 = respSli1.value;
var currentResponse2 = respSli2.value;
if( currentResponse1 != Sli1Old ) {
DomSli = 1;
} else {
DomSli = 2;
}
if( DomSli == 1) {
try {
var forceAns2 = 1- Math.pow(1 - currentResponse1, 2);
document.getElementById(currentQuestionID +'~2~result').setValue(forceAns2);
document.getElementById(currentQuestionID +'~2~bar').style.width= forceAns2 + "px";
}
catch(e) {
}
}
var currentResponse1 = respSli1.value;
var currentResponse2 = respSli2.value;
Sli1Old = currentResponse1;
Sli2Old = currentResponse2;
});
});
I don't know much javascript and am relatively new to qualtrics, so any and all help is appreciated.
本文标签: javascriptDynamically update sliders in QualtricsStack Overflow
版权声明:本文标题:javascript - Dynamically update sliders in Qualtrics - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736303846a1932021.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论