I am using Javascript to replace images in a series of matrix table questions, following the procedure described here.
For some of the questions, the images are not being replaced when the page initially loads. If I click the "next" button, causing Qualtrics to prompt me to answer the question, the image will then consistently be replaced. This makes me suspect that the Javascript is executing before there is an image to be replaced or that I am experiencing a redraw problem as reported here.
Is there a way to more consistently replace images or to trigger the same refresh that is being done when Qualtrics prompts for the question to be answered?
Javascript (same results if I put it in the OnLoad or OnReady sections):
var count = Number("${e://Field/count}");
var files = Qualtrics.SurveyEngine.getEmbeddedData('block_all');
file = files[count]
path = "https://sipacolumbia.co1.qualtrics.com/ControlPanel/Graphic.php?IM=" + file ;
var img = document.getElementById("imgdir");
img.src = path;
Qualtrics.SurveyEngine.setEmbeddedData("count", count + 1);
Question html (before replacement of image url):
Javascript sometimes fails to replace image without refresh
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
