+ 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
3 Réponses
+ 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
+ 2
window.onload = function() {
// your code goes here
}
This function will work
and you will not get any error.
+ 1
Prajyot Still it will because the variable ul has a string value