Which tag is used to enclose any number of JavaScript statements in HTML document?
(A)
<code>
(B)
<script>
(C)
<title>
(D)
<body>
Answer: (B)
Explanation:
<script>: The <script> tag in HTML is used to define the client-side script. The <script> tag contains the scripting statements, or it points to an external script file. The JavaScript is mainly used in form validation, dynamic changes of content, image manipulation, etc.
Syntax:
<script> Script Contents… </script>
<!DOCTYPE html>
<html>
<body>
<h1>GeeksforGeeks</h1>
<h2><script> Tag</h2>
<p id=”Geeks”></p>
<!– html script tag starts here –>
<script>
document.getElementById(“Geeks”).innerHTML =
“Hello GeeksforGeeks!”;
</script>
<!– html script tag ends here –>
</body>
</html>
Quiz of this Question
Please comment below if you find anything wrong in the above post