[Solved] Whats wrong here, why is innerHTML not working? [closed]

[ad_1] Make sure the div exists before trying to reference it, window.addEventListener(“load”,function() { document.getElementById(‘text’).innerHTML = localStorage.getItem(“mytext”); },false); That will wait for the document to load before doing any modifications 1 [ad_2] solved Whats wrong here, why is innerHTML not working? [closed]

[Solved] Javascript uncaught syntaxerror unexpected identifier error

[ad_1] In this line htmlStr += ‘<a id=”searchResult’+i+'” href=”https://stackoverflow.com/questions/29555599/javascript:liveSearch(“+arrOfSuggestText[i]+’)” > ‘+arrOfSuggestText[i]+'</a>’; and concrete here ‘” href=”https://stackoverflow.com/questions/29555599/javascript:liveSearch(“+arrOfSuggestText[i]+’)” > ‘ you try create calling function, but if you see value of this string, for arrOfSuggestText[i] == ‘qwe’ you can see something like href=”https://stackoverflow.com/questions/29555599/javascript:liveSearch(qwe)” and browser raise error what you get on qwe. So you need just add … Read more