JavaScript is the programming language of the web. It can update and change both HTML and CSS. It can calculate, manipulate and validate data.
Why study JavaScript?
JavaScript is one of the three (3) languages all web developers must learn. 1. HTML to define the content of web page. 2. CSS to specify the layout of web pages. 3. JavaScript to program the behavior of web pages.
JavaScript can change HTML Content
One of many JavaScript HTML method is getElementById(). The example below "finds" an HTML element (with id="demo"), and changes the element content (inner HTML) to "Hello JavaScript":
Copy the JavaScript code here
@Example 2: another method to chang HTML to JavaScript