JavaScript: Retrieve the current time from a 'Timing' question | XM Community
Skip to main content
Question

JavaScript: Retrieve the current time from a 'Timing' question

  • August 22, 2023
  • 1 reply
  • 110 views

Forum|alt.badge.img

Hi everyone,

I'm trying to retrieve the current time from a 'Timing' question type using JavaScript. I came across some older code that appeared to work in the past, but unfortunately, it's not functioning for me now. You can find the code snippet below. Does anyone have insights into what might be causing the issue? Is it possible that the class for the 'Timing' question type is no longer named 'Timer FlipClock'?

I greatly appreciate any assistance you can provide!

Here's the excerpt from the code that's relevant:

 

Qualtrics.SurveyEngine.addOnReady(function()

{

var timerID = document.getElementsByClassName('Timer FlipClock')[0].id;

       […]

       Event.observe(document, 'keydown', function (e) {

              var time = $(timerID).getAttribute('time');

              […]

       });

});

1 reply

Deepak
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+44
  • 1553 replies
  • August 22, 2023

The class is still Timer FlipClock.


Leave a Reply