Javascript examples for DOM HTML Element:Nav
The Nav object represents an HTML <nav> element.
You can access a <nav> element by using getElementById():
<!DOCTYPE html> <html> <body> <nav id="myNav"> <a href="#">HTML</a> | <a href="#">CSS</a> </nav>/*from w w w . j ava 2 s. c o m*/ <button onclick="myFunction()">get the HTML content of the nav element</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myNav").innerHTML; document.getElementById("demo").innerHTML = x; } </script> </body> </html>