Learn Javascript intro

JavaScript was initially created to “make web pages alive”.

Scripts are executed as plain text. There is no need for special preparation to run.

JavaScript is among the most powerful and flexible programming languages. It Bein used on most websites, including this one.

JavaScript can execute in the browser, but also on the server

Part 1

Change HTML content with javascript

One of JavaScript HTML methods is


In this example we will use the method to find an HTML element (we will give it the id="test") and change the element content (innerHTML) to " JavaScript":

Code Example:

document.getElementById("test").innerHTML = "JavaScript";

Try yourself >>

Part 2

Change HTML Attribute Values with javascript

In the next example JavaScript changes the value of the src (source) attribute of an image tag.

Try yourself >>

Part 3

Hide HTML Element with Javascript

You can hide HTML elements by changing the display style.

Code Example:

document.getElementById("test").style.display = "none";

Try yourself >>

tip: You can also show hidden HTML using Javascript, by changing the display style from "none" to "block".

Part 4

Change HTML Styles with JavaScript (CSS)

By changing the attribute, you can change HTML element style or size in this case.

Code Example:

document.getElementById("test").style.fontSize = "40px";

Try yourself >>

with FreeCodeWiki, you can learn Javascript courses and many other Programming classes for free , our main goal is to allow students to learn Javascript and other online coding courses in one place without paying and from your home.