+ 1
Why document.getElementById("validId ") return null even though the document is loaded and the id is valid.
Why dors document.getElementById("validId ") return null even though the document is loaded and the id is valid. https://code.sololearn.com/WVIHIywjw4u4/?ref=app
7 Answers
+ 3
this.onload expects a function, not a function call.
So it should be "this.onload = load;"
Otherwise "load" is not called as soon as the onload event occurs, but immediately on execution (=> before rendering).
+ 11
@Josh Have you looked at the setInterval tag? it would enable you to animate the progress bar.
+ 6
check that to more help https://stackoverflow.com/questions/8739605/getelementbyid-returns-null
+ 2
Obviously it will show null.
After all there is nothing inside the progress tag!
+ 2
I am aware of it. But thanks
+ 2
@kokossplityer
Thanks, your suggestion was what I needed.
+ 1
@cHiRaG GhOsH
You are mistaken. A pair of tag does not need to have any contents for it to not equal null. document.getElementById returns an object representing the node not the contents of the tags. The .InnerHTML property represents the tags contents.