JAVASCRIPT BASICS

JavaScript is one of the 3 languages all web developers must learn:

1. HTML to define the content of web pages

2. CSS to specify the layout of web pages

3. JavaScript to program the behavior of web pages

CHANGING VALUE WITH JS

One of many JavaScript or Js HTML methods is getElementById().

The example below “finds” an HTML element (with id=”demo”), and changes the element content (innerHTML) to “Hello JavaScript”:

document.getElementById(“demo”).innerHTML = “Hello JavaScript”;

You can also use double and single quates in js

WHERE TO ADD JAVA SCRIPT

In HTML, JavaScript code is inserted between <script> and </script> tags.

<script>
document.getElementById(“demo”).innerHTML = “My First JavaScript”;
</script>

Leave a comment

Design a site like this with WordPress.com
Get started