Hi, I want to display the elapsed time when the participant clicks some button. Here is what I did:
in the html code, i create one button and the message :
in the java code,
Qualtrics.SurveyEngine.addOnload(function() {
var starttime = new Date().getTime(); // start time is the page on load time
});
Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/
jQuery('#TimeButton').on('click', () => {
var pastWT = new Date().getTime()-starttime; // elapsed time is the button clicked time - start time
Qualtrics.SurveyEngine.setEmbeddedData('elapsedtime', pastWT); // update the embedded data value
jQuery("#msg2").show(); // display the message, the elapsed time is calculated above
});
});
These codes don't work. I have searched for the reason, is it because the embedded data's new set value can only be displayed in the next block? But I want to display this information in this block. How can I do it? Thanks!!