<html>
<body>
<h1 id="myH1" class="democlass">The Element Object</h1>
<h2>The getAttribute() Method</h2>
<p>The value of the class attribute of the h1 element is:</p>
<p id="demo"></p>
<script>
const element = document.getElementById("myH1");
let text = element.getAttribute("class");
document.getElementById("demo").innerHTML = text;
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_element_getattribute1 by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 21 Dec 2022 17:39:44 GMT -->
</html>