The element variable is not null before assign to the innerHTML property. it is an array with 5 elements. However it reports the null error after execution.
Asked
Active
Viewed 14 times
0
-
Could you share your HTML code? If possible in a runnable snippet? -- The error basically means the `#title` element cannot be found in the document. – nicovank Nov 09 '16 at 03:48
-
1It is not saying the `element[0]` is null, it is saying that `getElementById('title')` is returning null, hence there is no `innerHTML` property – Patrick Evans Nov 09 '16 at 03:48
-
See the answers on the linked post. Check if the element with that ID exists on the page when the function is executed. – Tushar Nov 09 '16 at 03:49