Javascript examples for DOM HTML Element:Div
The Div object represents an HTML <div> element.
You can access a <div> element by using getElementById():
<!DOCTYPE html> <html> <body> <div id="myDIV">This is a div element.</div> <button onclick="myFunction()">get the content of the div element</button> <p id="demo"></p> <script> function myFunction() {/*from ww w.java 2 s . c o m*/ var x = document.getElementById("myDIV").innerHTML; document.getElementById("demo").innerHTML = x; } </script> </body> </html>