how to use javascript in html
snippet in html

how to use javascript in html

user8449

<!-- include an external javascript document -->
<script src="myJavaScript.js" charset="utf-8"></script>

<!-- JavaScript inside html element -->
<script>
  console.log("This is JavaScript");
</script>

add script html

user306

<html>
  <head>
    <script type="text/javascript" src="/path/to/script.js"></script>
    ...

how to add javascript in html

user8957

<script src="script.js"></script>

include javascript in html

user8634


<script src="myScript.js"></script> 

how to use script tag

user3364

<script>
 document.getElementById("id").innerText = ("");
</script>

implement javascript in html

user1855

<!-- Option 1 -->
<script>
	document.getElementById("demo").innerHTML = "My First JavaScript";
</script>

 <!-- Option 2 -->
<script src="script.js"></script>