-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathHighlight unanswered questions_Request Response.js
40 lines (37 loc) · 1.27 KB
/
Highlight unanswered questions_Request Response.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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<n;i++){
if(jQuery("#"+that.questionId+" .ChoiceRow:eq("+i+") td input[type='radio']:checked").length==0){
jQuery("#"+that.questionId+" .ChoiceRow:eq("+i+")").css("background","lightpink");
}
}
}
this.questionclick = function(){
if(attempt>1){
console.log("test");
for(var i=0;i<n;i++){
if(jQuery("#"+that.questionId+" .ChoiceRow:eq("+i+") td input[type='radio']:checked").length!=0){
jQuery("#"+that.questionId+" .ChoiceRow:eq("+i+")").css("background","");
}
}
}
}
});
Qualtrics.SurveyEngine.addOnUnload(function() {
clearInterval(my_interval);
});