+ 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 Respuesta
+ 2
First of all you should use addEventListener not .onclick
5th Nov 2018, 2:04 AM
Toni Isotalo
Toni Isotalo - avatar