HTML DOM body Property Last Updated : 11 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The HTML DOM Body property is used to set the document <body> element. It only returns the content present in the <body> Tag. This property is used to change the present content inside the <body> element and sets them with the new specified content. This property does not return the <HTML> element.Syntax: This syntax returns the body property. document.bodyThis syntax is used to set the body property. document.body = ContentReturn Value: A reference to the Body Object, which represents a <body> elementProperty Value: The document.body property uses single value Content which is used to add new content in the body element.Example 1: In this example, we will use document.body property HTML <!DOCTYPE html> <html> <head> <title>DOM body property</title> <style> h1 { color: green; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h2>DOM body property</h2> <button onclick="geeks()">Submit</button> <p id="gfg"></p> <script> function geeks() { let x = document.body.innerHTML; document.getElementById("gfg").innerHTML = "Display the body content:<br>" + x; } </script> </body> </html> Output: Example 2: In this example, we will use document.body property HTML <!DOCTYPE html> <html> <head> <title>DOM body property</title> <style> h1 { color: green; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h2>DOM body property</h2> <button onclick="geeks()">Submit</button> <script> function geeks() { document.body.innerHTML = "<h1>" + "GeeksforGeeks" + "</h1>" + "<br>" + "<h2>" + "New Content Added" + "</h2>"; } </script> </body> </html> Output: HTML DOM body PropertySupported Browsers: The browser supported by DOM body property are listed below: Google ChromeEdge FirefoxOperaSafari Comment More infoAdvertise with us M manaschhabra2 Follow Improve Article Tags : Misc Web Technologies HTML HTML-DOM Practice Tags : Misc Explore HTML Tutorial 11 min read BasicsHTML Introduction 5 min read HTML Editors 5 min read HTML Basics 7 min read HTML Structure & ElementsHTML Elements 5 min read HTML Attributes 8 min read HTML Headings 4 min read HTML Paragraphs 5 min read HTML Text Formatting 4 min read HTML Block and Inline Elements 3 min read HTML Charsets 4 min read HTML ListHTML Lists 5 min read HTML Ordered Lists 5 min read HTML Unordered Lists 4 min read HTML Description Lists 3 min read HTML Visuals & MediaHTML Colors 11 min read HTML Links Hyperlinks 3 min read HTML Images 7 min read HTML Favicon 4 min read HTML Video 4 min read HTML Layout & DesignHTML Tables 10 min read HTML Iframes 4 min read HTML Layout 4 min read HTML File Paths 3 min read HTML Projects& Advanced TopicsHTML Forms 5 min read HTML5 Semantics 6 min read HTML URL Encoding 4 min read HTML Responsive Web Design 11 min read Top 10 Projects For Beginners To Practice HTML and CSS Skills 8 min read HTML Tutorial ReferencesHTML Tags - A to Z List 15+ min read HTML Attributes Complete Reference 8 min read HTML Global Attributes 5 min read HTML5 Complete Reference 8 min read HTML5 MathML Complete Reference 3 min read HTML DOM Complete Reference 15+ min read HTML DOM Audio/Video Complete Reference 2 min read SVG Element Complete Reference 5 min read SVG Attribute Complete Reference 8 min read SVG Property Complete Reference 7 min read HTML Canvas Complete Reference 4 min read Like