The Footer object represents an HTML <footer> element.
We can access a <footer> element via document.getElementById()
:
var x = document.getElementById("myFooter");
Click the button to get the content of the footer element.
<!DOCTYPE html> <html> <body> <footer id="myFooter"> <p>Some text in footer.</p> </footer>//from www. ja v a 2 s. c o m <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myFooter").innerHTML; document.getElementById("demo").innerHTML = x; } </script> </body> </html>