I'm new to using javascript in qualtrics. I am trying to implement a simple stopwatch on a survey item using this code https://learnwebsitedesign.com/tutorials/javascript-stopwatch-code-tutorial.php
It works for me in Visual Code Studio, when I source the javascrtipt code in my html file:
What is the equivalent to this src that I need to do in qualtrics? Just not sure what to put in the HTML to tell it to use the javascript for the button functionality.
Javascript Source (making a stopwatch)
Best answer by JeremyK
Alright, I see what's going on. Qualtrics doesn't let you attach event listeners in the html like your guide is doing. When you copy in the html, Qualtrics is stripping the onClick functions when you exit. If you view the html again, you'll notice they're gone. This just means we need to add the onClick in the JavaScript, no big deal. Add these two onClick listeners to the bottom of your JS function underneath your increment() function and you should be golden. Tested and confirmed this works on a survey of my own making.
jQuery('#startPause').on("click", function() {
startPause();
});
jQuery('#reset').on("click", function() {
reset();
});
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.
