0
What is problem?
https://code.sololearn.com/WA8hmr1aMZ0j/?ref=app Why does this show that variables are null?
1 Réponse
+ 4
Reason: You call input() before the DOM exists. After commenting your line 3, the error does not raise.
However, you also have not added click event listener to the buttons.
window.onload is the listener to ensure the scripts are executed after DOM exists.
A short cure for you:
https://code.sololearn.com/WWbWZ3FboGp8/?ref=app
// I have fixed button 2 for you, try to finish button 1 yourself.
Demo for full understanding :
https://code.sololearn.com/WriFNOoR188j/?ref=app