Hello,
I am using the following code to record key presses in my survey. For some reason, V and W are working fine, but when I add "D" I am getting an error. Does anyone see what is wrong with my code? I do not typically write code. Thank you!
Qualtrics.SurveyEngine.addOnReady(function() {
var i = 0;
var j = 0;
var k = 0;
document.onkeydown = function(event) {
if(event.key.toUpperCase() == "V"){
event.preventDefault();
i++;
Qualtrics.SurveyEngine.setEmbeddedData("V",i);
}
else if(event.key.toUpperCase() == ("W"){
event.preventDefault();
j++;
Qualtrics.SurveyEngine.setEmbeddedData("W",j);
}
else if(event.key.toUpperCase() == ("D"){
event.preventDefault();
k++;
Qualtrics.SurveyEngine.setEmbeddedData("D",k);
}
});
Key Press Code
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.
