!
var n=jQuery("#"+this.questionId+" .ChoiceRow").length;
if(jQuery("#"+this.questionId+" .ValidationError").text()!=""){
for(var i=0;i<n;i++){
if(jQuery(".ChoiceRow:eq("+i+") td input[type='radio']:checked").length==0){
jQuery(".ChoiceRow:eq("+i+")").css("background","lightpink");
}
}
}
> Paste the below code in the js(OnReady) of the matrix question
>
> var n=jQuery("#"+this.questionId+" .ChoiceRow").length;
> if(jQuery("#"+this.questionId+" .ValidationError").text()!=""){
> for(var i=0;i<n;i++){
> if(jQuery(".ChoiceRow:eq("+i+") td input[type='radio']:checked").length==0){
> jQuery(".ChoiceRow:eq("+i+")").css("background","lightpink");
> }
> }
>
> }
Thanks for the answer! But if I have more than one matrix in the section it only seems to work on the first one. Do you know how I could generalise it to work on all of them?
Many Thanks
> Thanks for the answer! But if I have more than one matrix in the section it only seems to work on the first one. Do you know how I could generalise it to work on all of them?
>
> Many Thanks
Here is the updated code:
var n=jQuery("#"+this.questionId+" .ChoiceRow").length;
if(jQuery("#"+this.questionId+" .ValidationError").text()!=""){
for(var i=0;i<n;i++){
if(jQuery("#"+this.questionId+" .ChoiceRow:eq("+i+") td input[type='radio']:checked").length==0){
jQuery("#"+this.questionId+" .ChoiceRow:eq("+i+")").css("background","lightpink");
}
}
}
> > @viki said:
> > Thanks for the answer! But if I have more than one matrix in the section it only seems to work on the first one. Do you know how I could generalise it to work on all of them?
> >
> > Many Thanks
>
>
> Here is the updated code:
>
> var n=jQuery("#"+this.questionId+" .ChoiceRow").length;
> if(jQuery("#"+this.questionId+" .ValidationError").text()!=""){
> for(var i=0;i<n;i++){
> if(jQuery("#"+this.questionId+" .ChoiceRow:eq("+i+") td input[type='radio']:checked").length==0){
> jQuery("#"+this.questionId+" .ChoiceRow:eq("+i+")").css("background","lightpink");
> }
> }
> }
>
>
This works great, thank you!
Is there any way to get this code to work to highlight just individual statements/lines within the matrix question (as opposed to highlighting all statements, completed or not)? Thanks.
Hello, it is possible to modify the code so that it highlights unanswered statements within a matrix table with 'request response' selected rather than 'force response'? Thanks!
https://www.qualtrics.com/community/discussion/comment/32186#Comment_32186The following code should work for you:
let my_interval;
Qualtrics.SurveyEngine.addOnReady(function(){
let attempt = 1;
document.querySelector("#NextButton").onclick = function() {
my_interval = setInterval(() => {
err_msg = document.querySelector("#ErrorMessage");
if (err_msg != null) {
console.log("done");
solver();
clearInterval(my_interval);
}
}, 10);
};
that = this;
var n = jQuery("#"+this.questionId+" .ChoiceRow").length;
function solver (){
attempt++;
for(var i=0;i
jQuery("#"+that.questionId+" .ChoiceRow:eq("+i+")").css("background","lightpink");
}
}
}
this.questionclick = function(){
if(attempt>1){
for(var i=0;i
jQuery("#"+that.questionId+" .ChoiceRow:eq("+i+")").css("background","");
}
}
}
}
});
Qualtrics.SurveyEngine.addOnUnload(function() {
clearInterval(my_interval);
});
https://www.qualtrics.com/community/discussion/comment/32400#Comment_32400Hey could you provide this exact code except for a "side by side" instead of a matrix table?? that would be so great!
Have you tried this code? It should work for SBS also.
https://community.qualtrics.com/XMcommunity/discussion/comment/32400#Comment_32400Hi ahmedA , is there any other code for a slider question? I have tried to use this code for a slider question but it doesn't work.
Thank you very much.
I wonder if there is a method to do this with the Form question type?
This was great, but I’m using statement groups and if one selection is not made in one statement group, it highlights are the statement group headers. Any modification for this, please and thank you?!
This was great, but I’m using statement groups and if one selection is not made in one statement group, it highlights are the statement group headers. Any modification for this, please and thank you?!
You might be interested in the matrixHighlightUnanswered function. It has much more functionality than the code above, including compatibility with statement groups.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.