I want to add a New list item in my ul. I have error. Thanks you. | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

I want to add a New list item in my ul. I have error. Thanks you.

Add a New list item. https://code.sololearn.com/WBFL5Cr7OSIX/?ref=app

25th Jan 2021, 6:06 AM
Malick Diagne
Malick Diagne - avatar
3 Antworten
+ 2
Sl runs Javascript before html renders so there is no element in there so we need window.onload so the script runs after the document is renderd. Also you had selected the innerHTML atrribute so it will returns the content rather that the element itself. Hope it helps Fixed code: https://code.sololearn.com/WY8eFr9axWKA/?ref=app
25th Jan 2021, 6:30 AM
Aradhay Mathur
Aradhay Mathur - avatar
+ 2
window.onload = function() { // your code goes here } This function will work and you will not get any error.
25th Jan 2021, 6:31 AM
Prajyot
Prajyot - avatar
+ 1
Prajyot Still it will because the variable ul has a string value
25th Jan 2021, 6:32 AM
Aradhay Mathur
Aradhay Mathur - avatar