Javascript DOM HTML Small Object

Introduction

The Small object represents an HTML <small> element.

We can access a <small> element via document.getElementById():

var x = document.getElementById("mySmall");

Click the button to set the color of <small> element to red.

View in separate window

<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">Test</button>

<script>
function myFunction() {/*  w ww .ja va2  s .c  o m*/
  var x = document.getElementById("mySmall");
  x.style.color= "red";
}
</script>

</body>
</html>



PreviousNext

Related