We can create a <b> element by using the document.createElement()
method:
Click the button to create a B element with some text.
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <script> function myFunction() {/*from www. j ava 2 s.c o m*/ var x = document.createElement("B"); var t = document.createTextNode("Some bold text"); x.appendChild(t); document.body.appendChild(x); } </script> </body> </html>