Javascript DOM HTML Strong Object get

Introduction

The Strong object represents an HTML <strong> element.

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

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

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

View in separate window

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

<script>
function myFunction() {//from   w  w w  .j a  va  2  s .  c  o  m
  var x = document.getElementById("myStrong");
  x.style.color = "red";
}
</script>

</body>
</html>



PreviousNext

Related