How do i fix an uncaught reference error thats tell me that my function is not defined. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do i fix an uncaught reference error thats tell me that my function is not defined.

Im trying to create a music catalogue that captures user input and saves it to localStorage using json.i have no idea why the code i have written so far is not working.There is my code: https://code.sololearn.com/Wk8AvpQH0jXP/?ref=app

22nd Mar 2021, 11:17 AM
CedyAdvance
2 Answers
+ 3
at least in android app, the js code in the js tab is included in head section of the html, meaning when it run, the document body is not parsed and no elements are accessible at this time... you must run code accessing DOM after document load event by wrapping it in an onload event handler: onload = function() { // here DOM is accessible };
22nd Mar 2021, 11:28 AM
visph
visph - avatar
+ 1
Thanks visph.let me do what you have just explained.
22nd Mar 2021, 11:37 AM
CedyAdvance