Where to Write Javascript - How to add Javascript to HTML



Where to Write Javascript - How to add Javascript to HTML

  • In HTML, JavaScript code is inserted between <script> and </script> tags.

Sample Code

how-to-write-javascript
<html>

<body>
 <h2>JavaScript in Body</h2>
 <p id="demo"></p>
 <script>
  document.getElementById("demo").innerHTML = "My First JavaScript";

 </script>
</body>

</html>

Output

Javascript Introduction

Related Searches to Where to Write Javascript - How to add Javascript to HTML