Standard Standalone? : Yes. Using the Builder (I also manually changed some of the JavaScript code)
What are you trying to achieve?: In my experiment, I first collect text input from participants (e.g., “cui1”), then I provide feedback regarding whether the input is correct.
Problem: The feedback part breaks after I put this experiment online. The feedback part always judges the text input to be wrong (i.e., even correct answers are judged to be wrong).
What did you try to make it work?: (1) Forcing the text input and the correct answer into string by using the String() function; (2) Changing the position of the if statements for feedback.
Thank you so much for introducing console.log() to me. This is super useful!
I added console.log(text.text) and console.log(correct) before the if statement (now line 503 and 504). Unfortunately, console.log() seems to show that even when text.text and correct are equal, the if statement still judges it to be false …
I got the issue solved by doing two things: (1) displaying the correct (setting the opacity to 0 so the appearance of the experiment stays the same); (2) using .valueOf() expression for comparison of texts. Below are the relevant codes.