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
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
};
+ 1
Thanks visph.let me do what you have just explained.