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