The Nav object supports the standard properties and events.
We can access a <nav> element by using getElementById().
<!DOCTYPE html>
<html>
<body>
<nav id="myNav"><a href="#">HTML</a> |<a href="#">CSS</a></nav>
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<!-- w w w .jav a 2 s . c om-->
<script>
function myFunction() {
var x = document.getElementById("myNav").innerHTML;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
The code above is rendered as follows: