+ 3
Event handler
I am having problems using events in javasript.....Can sololearn support events in javascript???
1 Answer
+ 1
Yes sololearn supports event
Sololearn compiles web code by putting scripts in JS tab in the head of html. Therefore all getElementById or similar attempt will return null because the element doesn't exist yet.
https://code.sololearn.com/WriFNOoR188j/?ref=app
1. One of the solution is to put the JavaScript scripts in
window.onload = function () {
.. Your JS codes....
}
2. This demo different way to add event listener :
https://code.sololearn.com/W0ehmlP2Y3I3/?ref=app