Create an Underline Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Underline


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

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

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

function myFunction() {/*w w w .j  ava  2s.c om*/
    var x = document.createElement("U");
    var t = document.createTextNode("This text is underlined");


Related Tutorials