I am trying to remove the default display of zero from a constant sum question.
I normally use this code and it worked for questions with multiple choices.
var inputWidth = "75px";
var q = jQuery("#"+this.questionId);
q.find('.SumInput').css("width", inputWidth);
q.find('.SumTotal').css("width", inputWidth);
q.find('.InputText').css("width", inputWidth);
var inputs = jQuery("#"+this.questionId+" .SumInput input");
if(inputs.filter(function() {return this.value != "0";}).length == 0) {
inputs.val("");
}
But in this case, I only have one text box and no total box.
Change
jQuery("#"+this.questionId+" .SumInput input");
to
jQuery("#"+this.questionId+" .SumInput");
Thanks!
Hi TomG ,
So I used the code above for a matrix table with 2 constant sum columns. How can I implement this for the second column (B)?
col A col B
statement 1
statement 2
https://www.qualtrics.com/community/discussion/comment/31141#Comment_31141Use:
jQuery("#"+this.questionId+" .c5 > input");
Instead of having to ask every time, you need to learn how to inspect html source and how CSS selectors are written.
Thanks!
I try my best to do a search first before I post something. Usually around 80% of what I am looking for, I find just by googling. We have been using Qualtrics for 7 months but we are tasked to convert our complex Confirmit surveys to this platform.
I didn't know about inspecting html sources until 2 days ago when I found this informative post: https://www.qualtrics.com/community/discussion/5819/using-jquery-to-make-a-field-read-only
Usually, someone asks here and a code is posted and I always wonder how they came up with the solution. Now I know.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.