Code customized feedback in Qualtrics | XM Community
Skip to main content

Hello,
I am currently coding my thesis experiment and can't figure out how to code individual feedback for single questions. More specifically, I have several questions in a matrix and depending on whether the participant responds with "yes" a customized feedback should appear in a typing effect next to the question (it should appear to the participant like someone else is virtually responding to the participant's response in real-time) . When the participants responds with "no" different feedback should appear. I think the best ways is to use JavaScript and define if statements for every questions. However, my code it not working. Your help is much appreciated and needed!

Post your code.


Hey TomG
Thanks for the quick response and your help!
Here is the JavaScript code:

function typeWriter() {
   if (i < txt.length) {
     document.getElementById("demo").innerHTML += txt.charAt(i);
     i++;
     setTimeout(typeWriter, speed);
   }
 }
var i = 0;
 var speed = 100;
var a = "Was the gray-haired man’s name Louis?"; 
if (a=="Yes") {
 var txt = "I agree";
} else if (a=="No") {
 var txt = "I do not agree";
typeWriter();


Leave a Reply