Hi! I start saying that I am really inexperienced with javascript and HTML. In my survey, I have a button that, when toggled, displays a video. I also have a variable controlling that the respondents have clicked on the button.
PROBLEM:
I would like to add a variable that tells me how many seconds have passed when the user clicks on the video (best option) or on the button for the first time.
To my understanding, the solutions could be 2: 1) I create a variable that gives me the timestamp of when the user visualizes the page and one of when he clicks the video/button and then i subtract them; 2) I create a variable of the second passed until the first click on video/button
The problem is that I have no clue how to do it... Even if I have looked for solutions around the web. I hope you can help me.
CURRENT CODE:
JAVA
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
var button1Click = 0
jQuery("#button1").click(function () {
Qualtrics.SurveyEngine.setEmbeddedData('button1_clicks', ++button1Click);
jQuery("#infodiv1").toggle();
});
HTML
Be the first to reply!
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.