HTML DOM Small Object | HTML Small Code Tutorial By WDH

HTML DOM Small Object


 

The following code shows how to get a <small> element by using getElementById().


<!DOCTYPE html>
<html>
<body>
<small id="mySmall">small</small>
<button onclick="myFunction()">test</button>
<script>
function myFunction() {<!--   w w  w  . j  a v  a2s  .c  o  m-->
    var x = document.getElementById("mySmall");
    x.style.color= "blue";
}
</script>
</body>
</html>

The code above is rendered as follows: