HTML JavaScript is the most popular programming language that helps to add interactivity and provides dynamic behavior. It is known as the client-side scripting language for web pages. JavaScript is used for various purposes, including DOM manipulation, asynchronous requests (AJAX), event handling, fetching external API, and creating interactive web applications.
Additionally, After ES6 JavaScript becomes more popular and provides various functionalities for creating dynamic web pages.
Integrating JavaScript using HTML <script> Tag
The HTML <script>
tag is used to integrate JavaScript code or give reference through the attribute "src" for external JavaScript files within an HTML document.
With the help of JavaScript, we can dynamically manipulate the HTML elements. Various HTML JavaScript operations can be done including, DOM manipulation, Adding or removing Style to the element, and adding or removing elements from the DOM.
Note: The most common operation done in JavaScript is finding the HTML elements.
Example: Illustration of the basic example of JavaScript that finds the element by tag name and styles the text with green.
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>HTML JavaScript</title>
</head>
<body>
<h1>GeeksforGeeks</h1>
<h3>HTML JavaScript</h3>
<script>
const h1element = document
.getElementsByTagName("h1")[0];
h1element.style.color = "green";
</script>
</body>
</html>
Output

HTML <noscript> Tag
The HTML <noscript>
tag is used to provide information displayed when a browser does not support or has disabled JavaScript in their browser.
Note: If the JavaScript is supported by your browser, the text inside the <noscript> tags will not rendered to the User Interface.
Example: Illustration of the basic example of HTML <noscript> tag.
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>HTML JavaScript</title>
</head>
<body>
<h1 id="gfg">GeeksforGeeks</h1>
<h3>HTML JavaScript</h3>
<script>
const h1element = document
.getElementById("gfg");
h1element.style.color = "green";
</script>
<noscript>The browser you are using
doestnot support JavaScript.
</noscript>
<p>If the JavaScript is supported by your browser the
text inside the noscript tag will not be shown to you.
</p>
</body>
</html>
Output:
Similar Reads
JavaScript HTML DOM The JavaScript HTML DOM (Document Object Model) is a powerful tool that represents the structure of an HTML document as a tree of objects. It allows JavaScript to interact with the structure and content of a webpage. By manipulating the DOM, you can update the content, structure, and styling of a pa
4 min read
HTML | DOM Script Object The DOM Script Object is used to represent the HTML <script> element. The script element is accessed by getElementById(). Properties: async: It is used to specify the script is executed asynchronously. charset: It is used to specify the character encoding used in an external script file. defer
2 min read
HTML <script> Tag The HTML <script> tag embeds client-side scripts or links to external JavaScript files, enabling dynamic content, form validation, and style manipulation. Attributes like async, defer, and src control script execution and loading, enhancing the interactivity and performance of web pages.Syntax
3 min read
HTML DOM Subscript Object The Subscript Object in HTML DOM is used to represent the HTML <sub> element. The subscript element can be accessed by using the getElementById() method. Syntax: document.getElementById("id") Where id is assigned to the <sub> tag. Example 1: In this example, we will use DOM Subscript Obj
1 min read
Difference between JavaScript and HTML JavaScriptJavaScript is a programming language that conforms to the ECMAScript specification. It is a high-level scripting language introduced by Netscape to be run on the client-side of the web browser. It can insert dynamic text into HTML. JavaScript is also known as the browserâs language. HTMLHT
2 min read