How to make an image disappear after a few seconds but the question next to it stays displayed | XM Community
Skip to main content

Hello!
I would be very happy for your help!!
I'm looking for how to make an image disappear after a few seconds but the question next to it to stay displayed until the participant finishes the rating.
I tried to use the timer option, but I need the question to appear next to the image both when the image is displayed and afterwards. That is, I want an image to be displayed next to a rating question, and after 3 seconds i want the image to disappear but the question to remain displayed until the participant finishes rating.
thank you very much!!

You'll need to use JavaScript's setTimeout() function to hide the image after 3000 milliseconds. Add something like this to the rating question's addOnReady function:
var img = jQuery("#"+this.questionId+" img");
setTimeout(function() { img.hide(); },3000);


it worked! 😊
Thank you very much!


TomG
Hi! Could you advise how to change the code so as I can replace the image with another (instead of hiding it)? Thank you.


https://www.qualtrics.com/community/discussion/comment/35060#Comment_35060I haven't tried this, but try replacing the image's src attribute.
var img = jQuery("#"+this.questionId+" img");
setTimeout(function() { img.attr("src","url of image goes here"); },3000);


Leave a Reply