Get Bold Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Bold

Introduction

The Bold object represents an HTML <b> element.

You can access a <b> element by using getElementById():

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<b id="myB">this bold text</b>

<button onclick="myFunction()">Test</button>

<script>
function myFunction() {//  ww w.  j a  v  a 2s  .co  m
    var x = document.getElementById("myB");
    x.style.color = "red";
    x.style.border = "1px blue solid";
}
</script>

</body>
</html>

Related Tutorials