Hi all,
I have a piece of JavaScript which creates a radio button for a specified row in a singular constant sum question. When the button is selected, the total becomes 100.
However, I am trying to implement this same concept to a constant sum question with two columns instead of one. I am a bit stumped on the correct route to address. I am not too familiar with the Qualtrics API just yet.
Here is the code which works for the singular column:
Qualtrics.SurveyEngine.addOnReady(function()
{
/* SETTINGS */
var row=3; /* what row is the "don't know" row? */
/* END OF SETTINGS */
var qid=this.questionId;
var dk = document.getElementsByName("QR~"+qid+"~"+row);
for (i = 0; i < dk.length; i++) {
dkki].type = "radio";
}
var inputs = $(this.getQuestionContainer()).select('inputttype="text"]');
dkk0].onclick = function(){
for (var i = 0; i < inputs.length; i++) {
inputsti].value="0";
}
dkd0].value = "100";
}
for (var i = 0; i < inputs.length; i++) {
var input = inputsui];
$(input).insert({after: ' %'});
inputsui].onclick = function(){
dk 0].value = "0";
dk 0].checked=false;
}
}
dk>0].style.zIndex = "auto";
dk>0].style.opacity = "1";
dk>0].style.height = "1em";
});
Can anyone direct me on how I can get this to work so the Don't Know Button shows up in both columns? I assume it has to do with the use of the row variable declared in the dk variable and there needs to be additional code to execute the same sequence for the second column, but I am stumped.
Any suggestions is much appreciated. Thanks
Be the first to reply!
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.