+ 1

A question on this code __

There's the variable called "made", and Variable "typ". Now -- typ.innerHTML = x _ works; But made.innerHTNL = x _ doesn't work. Why is that & how do u fix that? https://code.sololearn.com/WCDLn1X4J6EG/?ref=app

28th Jul 2019, 6:54 AM
Ginfio
Ginfio - avatar
1 Odpowiedź
0
The order of your code is incorrect. document.getElementsById will only find elements that were added to the DOM. In your code however you call this function before you added the element (by using appendChild) so it doesn't find the element. Simply changing the order of both lines will make it work :)
28th Jul 2019, 8:59 AM
Aaron Eberhardt
Aaron Eberhardt - avatar