patricia_grace
-
Posts
2 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by patricia_grace
-
-
In the beginning of the JavaScript tutorial, there are several examples of working with JavaScript that don't include any script tags. I was able to duplicate the examples with my own text editor and browser, also.
However, later in the tutorial it is stated "In HTML, JavaScript code must be inserted between <script> and </script> tags."
It is a bit confusing, and I am wondering why the script tags weren't needed in the first few examples, such as the one below:
<!DOCTYPE html><html><body><h1>What Can JavaScript Do?</h1><p id="demo">JavaScript can change HTML content.</p><button type="button" onclick="document.getElementById('demo').innerHTML = 'Hello JavaScript!'">Click Me!</button></body></html>Which runs fine without the script tags. I was able to duplicate it with my own text editor and browser.Thanks in advance for any help offered!patricia
Script tag needed...?
in JavaScript
Posted
Perfect, thanks so much. It's reassuring to have confirmation!