Javascript DOM HTML Underline Object get

Introduction

The Underline object represents an HTML <u> element.

We can access a <u> element via document.getElementById():

var x = document.getElementById("myU");

Click the button to set the color of <u> element to red.

View in separate window

<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">Test</button>
<script>
function myFunction() {/*from  ww  w .  ja  v a  2 s .  c o  m*/
  var x = document.getElementById("myU");
  x.style.color = "red";
}
</script>

</body>
</html>



PreviousNext

Related