Accessing Html Elements

Lesson 13
Author : Afrixi
Last Updated : October, 2017


Table of Content

Code

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