1 2 3 4 5 6 7
<!DOCTYPE html> <meta charset="utf-8"> <body>foo <button id="element"></button> <script> window.text = document.body.firstChild; </script>