Why my functions cannot work? | XM Community
Skip to main content

I'm new to javasript programming, so I have no idea why my code cannot work properly on qualtrics. This code aims to conduct a simple research. The participants need to click the "add" button to add red balls into the box, and if they want to draw a ball from the box, they should click the "draw button". If the participants pick a red ball, they win the game.
When I ran the code attached below, the console showed that my functions were not defined. Would you please give me some advices? Thanks a lot!
Javacript code:



Welcome to the game!









https://mays.ca1.qualtrics.com/ControlPanel/Graphic.php?IM=IM_3CoVCiGYSBcYWhL" width="320" height="240">













On just going through the code, one mistake we can see is that - 'document.write' function is disabled in qualtrics. So instead of that, you can use some p tag with id to display the text.


Also, don't put JavaScript in the question text. Click "Add JavaScript..." and add your JavaScript there. Put the JS inside the addOnload function.


Leave a Reply