Javascript - Program the Web
This course covers the basics of programming in Javascript. Work your way through the videos/articles and I'll teach you everything you need to know to make your website more responsive!

Accessing Html Elements

Lesson 13
Author : GOUP
Last Updated : September, 2020


Code

index.htmlCopy
<h1 id="myHeader" giraffe="Giraffe Attr">GOUP</h1> <script src="script.js"></script>
script.jsCopy
var header = document.getElementById("myHeader"); header.style="color:blue; background-color:red;" document.write( header.getAttribute("giraffe") ); header.innerHTML = "Elephant Academy";