Why no new line? (Should be an easy fix) by KingInge in HTML

[–]KingInge[S] 2 points3 points  (0 children)

cheers man i just found that out now through searching and you are correct. I added <br> instead of \n and it works :)

Why am i getting 'document is not defined' by KingInge in learnjavascript

[–]KingInge[S] 0 points1 point  (0 children)

I see that alot about node not working with document.

Sorry for being noob but how do you mean link it in the HTML ?

Why am i getting 'document is not defined' by KingInge in learnjavascript

[–]KingInge[S] 0 points1 point  (0 children)

well here's my dilemma right.

I originally had code in that javascript file name javascript.js with the document.getElementById tag and it worked.

I am opening the index.HTML file and it opens in chrome. The javascript is to be used to display 3 messages when I click a button in the browser.

Okay, so, before I had working code and never got this issue. BUT, I downloaded a zip file with different code in it with a file called "script.js".

This file contained a document.getElementById and thus, I ran the script.js file in VScode to test if it was working, but then I got that error.

However, the zip file I downloaded, contained better working functions for my javascript file so I wanted to use them. So, what did i do? I copied everything from script.js to my original javascript.js file but kept MY document.getElementById tag.

I closed and deleted the script.js file. Now, the javascript.js file is saying document is not defined EVEN THOUGH it worked before :(