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
Javascript to add a time variable when toggling a button/video
Sign up
Already have an account? Login
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login to the Community
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
