 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML DOM HTML Object
The HTML Object represents the element of an HTML document.
Let us see how to access HTML object −
Syntax
Following is the syntax −
document.getElementsByTagName(“HTML”)
Let us see an example of HTML object −
Example
<!DOCTYPE html> <html> <head> <style>    body{       text-align:center;    }    .btn{       background-color:lightblue;       border:none;       height:2rem;       border-radius:50px;       width:60%;    margin:1rem auto;    }    .show{       font-size:1rem;       font-weight:bold;       color:orange;       border:2px solid green;       padding:10px;       display:none;    } </style> </head> <body> <h1>DOM HTML Object Example</h1> <button type="button" onclick="getContent()" class="btn">Click me to get content inside HTML tag</button> <div class="show"></div> <script>    function getContent(){       var content=document.getElementsByTagName("HTML")[0].innerHTML;       document.querySelector(".show").innerHTML = content;       document.querySelector(".show").style.display ="block";    } </script> </body> </html> Output
This will produce the following output −

Click on “blue” button to get all content inside this page tag −

Advertisements
 