Get Underline Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Underline

Introduction

The Underline object represents an HTML <u> element.

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

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<u id="myU">this underlined text</u>

<button onclick="myFunction()">set the color</button>

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

</body>
</html>

Related Tutorials