0

What is the problem with this code

I don't know what is the problem https://code.sololearn.com/WR35uYakF4Oo/?ref=app

24th Dec 2019, 4:18 PM
Abdullah Adel
Abdullah Adel - avatar
3 Answers
0
So what's happening is that the JavaScript code loads first, so it doesn't have access to the elements on the web page. You can do this to prevent an error: window.onload = function() { document.getElementById("hours").innerHTML = calalc(x); } This basically runs the code inside it once the window fully loads, including HTML.
25th Dec 2019, 3:19 PM
Jianmin Chen
Jianmin Chen - avatar
24th Dec 2019, 4:18 PM
Abdullah Adel
Abdullah Adel - avatar
0
This is my code đŸ‘†đŸ»đŸ‘†đŸ»đŸ‘†đŸ»đŸ‘†đŸ»đŸ‘†đŸ»
24th Dec 2019, 4:18 PM
Abdullah Adel
Abdullah Adel - avatar