How to fix this guys | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
12th May 2023, 4:57 AM
Leonard
2 Answers
+ 5
Modify line 1 in JS to: onload=()=>{ document.getElementById('solve').addEventListener("click", function(){ at last line put } at end explanation: 1. why use "document.getElementById('solve')"? if you just use solve without explicitly referencing it through document.getElementById(), the code will look for a global variable named "solve". 2. Why use "onload=()=>{...}"? The onload event is used to ensure that all of the resources required by a web page are loaded and ready before executing any JavaScript code.
12th May 2023, 5:03 AM
I am offline
I am offline - avatar
+ 3
Thx it's really helpful
12th May 2023, 5:28 AM
Leonard