Someone???? I need help with JavaScript. So......... | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

Someone???? I need help with JavaScript. So.........

My problem is that I have my code inside a ā€œwindow.onloadā€ function. And then a ā€œbutton.onclickā€. Inside the ā€œbutton.onclickā€ function I have a ā€œresult.innerHTML = Numberā€. When I click the button the string changes but only like 3 seconds and it becomes the first string. I think that that is happening because is changing when the button is clicked. I need help with that. Iā€™ll post the code in a following post so you can understand me better. My code has images so I donā€™t know if SoloLearn would lag. Also I want to know how to keep track of life and donā€™t always start again at 60. Thank you. Here is the Code: https://code.sololearn.com/Wkw4M45yLPh5/?ref=app

4th Nov 2018, 7:52 PM
Octavio Aguayo
Octavio Aguayo - avatar
1 Resposta
+ 2
First of all you should use addEventListener not .onclick
5th Nov 2018, 2:04 AM
Toni Isotalo
Toni Isotalo - avatar