Create a Bold Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Bold


You can create a <b> element by using the document.createElement() method:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<button onclick="myFunction()">create a B element with text</button>

function myFunction() {/*  w w  w.  ja v  a2s. co  m*/
    var x = document.createElement("B");
    var t = document.createTextNode("Some bold text");


Related Tutorials