JS Tutorial
JS Version
JS Objects
JS Function
JS Classes
JS Async
JS HTML DOM
JS Browser BOM
JS Web API
JS AJAX
JS JSON
JS vs JQUERY
JS Graphics
JavaScript Introduction
JavaScript Can Change HTML Content
JavaScript HTML methods is getElementById().
The below example “finds” an HTML element (with id=”demo”), and is used to change the element content (innerHTML) to “Hello JavaScript”:
Example
What Can JavaScript Do?
JavaScript can change HTML content.
Output
What Can JavaScript Do?
JavaScript can change HTML content.
JavaScript is used for both double and single quotes:
Example
What Can JavaScript Do?
JavaScript can change HTML content.
Output
What Can JavaScript Do?
JavaScript can change HTML content.
JavaScript Can Change HTML Attribute Values
In this example JavaScript the value of the src (source) attribute of an <img> tag is changed:
Example
What Can JavaScript Do?
JavaScript can change HTML attribute values.
In this case JavaScript changes the value of the src (source) attribute of an image.
Output
What Can JavaScript Do?
JavaScript can change HTML attribute values.
In this case JavaScript changes the value of the src (source) attribute of an image.

JavaScript Can Change HTML Styles (CSS)
To change the style of an HTML element, is a variant of changing an HTML attribute:
Example
What Can JavaScript Do?
JavaScript can change the style of an HTML element.
Output
What Can JavaScript Do?
JavaScript can change the style of an HTML element.
JavaScript Can Hide HTML Elements
HTML elements is hidden by changing the display style
Example
What Can JavaScript Do?
JavaScript can hide HTML elements.
Output
What Can JavaScript Do?
JavaScript can hide HTML elements.
JavaScript Can Show HTML Elements
Displaying hidden HTML elements can be done by changing the display style:
Example
What Can JavaScript Do?
JavaScript can show hidden HTML elements.
Hello JavaScript!
Output
What Can JavaScript Do?
JavaScript can show hidden HTML elements.
Hello JavaScript!