Get HR Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:HR

Introduction

The HR object represents an HTML <hr> element.

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

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<hr id="myHR">

<button onclick="myFunction()">hide the HR element</button>

<script>
function myFunction() {/*from ww  w .j ava 2 s  .c  o m*/
    var x = document.getElementById("myHR");
    x.style.display = "none";
}
</script>

</body>
</html>

Related Tutorials