+ 4
I need help debugging this code
This code returns an error on line 29 but I’ve failed to rectify it. All kinds of help is highly appreciated 🙏🏽 Thank you 😊 https://code.sololearn.com/Wj0M4WHqEeyG/?ref=app
6 Réponses
+ 4
You have to surround your complete JavaScript with
window.onload = function(){
/* here comes your code */
}
This ensures that your JavaScript waits to start until the whole HTML code is loaded which is done by the onload-event.
The error is caused by the fact that the JavaScript runs before the HTML is loaded completely, and that's the reason why some elements, which you refer to in the JavaScript, are not present yet.
improved code:
https://code.sololearn.com/W1LRFyOMVVkr/?ref=app
+ 5
Jan Markus thank you so much 🤝🏽
+ 4
Izaiah Kay
You are welcome! 🙂👍
+ 3
Izaiah Kay
Now I have also improved the code that the score is adapted during the quiz.
Only at the last question there has to be inserted a delay before proceeding to the evaluation.
+ 2
Thank you so much Jan Markus
Here’s the debugged code. With credits to you
https://code.sololearn.com/Wj0M4WHqEeyG/?ref=app
+ 2
Jan Markus
Thats very cool