HTML DOM Output Object Last Updated : 21 Nov, 2022 Comments Improve Suggest changes Like Article Like Report The HTML DOM Output Object is used to represent the HTML <Output> Tag . The output element is accessed by getElementById(). Syntax: document.getElementById("id"); Where “id” is the ID assigned to the “output ” tag. Values: default Value: It is used to set or return the default value of the <output> element.form: It returns a reference to the form that the <output> element belongs to.htmlFor: It is used to return the value of for the attribute of the <output> element.labels: It is used to return the list of label elements associated with <output> element.name: It is used to set or return the value of the name attribute of an <output> element.type: It returns which type of HTML element the Output object represents.value: It is used to set or returns the value of the value attribute of the <output> element. Example 1: Below HTML code returns the value of the output element. By using the getElementById() method to access the Output tag. HTML <!DOCTYPE html> <html> <head> <title> HTML DOM Output Object </title> <style> body { text-align: center; } h1 { color: green; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h2> HTML DOM Output Object </h2> <form oninput="sumresult.value = parseInt(A.value) + parseInt(B.value) + parseInt(C.value)"> <input type="number" name="A" value="50" /> + <input type="range" name="B" value="0" /> + <input type="number" name="C" value="50" /> <br /> Submit Result: <output name="sumresult" id="geeks" for="A B C"> </output> <br> <br> </form> <Button onclick="myGeeks()">Submit</Button> <h2 id="sudo"></h2> <script> function myGeeks() { var x = document.getElementById("geeks").value; document.getElementById("sudo").innerHTML = x; } </script> </body> </html> Output: Example 2: Output Object can be created by using the document.createElement method. HTML <!DOCTYPE html> <html> <body> <center> <h2 style="color: green;"> GeeksForGeeks </h2> <h2 style="color: green;"> HTML DOM Output Object </h2> <p> Click the Below button to create an OUTPUT element. </p> <form id="GFG" oninput= "x.value=parseInt(a.value)+parseInt(b.value)">0 <input type="range" id="a" value="50">100 +<input type="number" id="b" value="50">= </form> <br> <button onclick="Create()">Try it</button> <p id="sudo"></p> </center> <script> function Create() { // Create an output tag var x = document.createElement("OUTPUT"); x.setAttribute("name", "x"); // Set name attribute x.setAttribute("for", "a b"); // Set firm attribute document.getElementById("GFG").appendChild(x); document.getElementById("sudo").innerHTML = `The output element was created. You can Change the value of the range or number field to see the result of a calculation.`; } </script> </body> </html> Output: List of Supported Browsers given below: Google Chrome 10.0 Edge 18.0Firefox 4.0Opera 11.0Safari 7.0 Comment More infoAdvertise with us Next Article HTML DOM Output Object M manaschhabra2 Follow Improve Article Tags : HTML HTML-DOM Similar Reads HTML | DOM Ol Object The DOM Ol Object is used to represent the HTML <ol> element . The ol element is accessed by getElementById(). To read more about lists check HTML | Lists. Properties: compact: It is used to set or return whether the size of the list would be displayed normal or not.reversed: It is used to set 2 min read HTML | DOM Ul Object The DOM Ul Object is used to represent the HTML <ul> element .the ul element is accessed by getElementById().Properties: compact: It is used to set or return whether the height of the unordered list would be render smaller than normal, or not. type: It is used to set or return the value of the 2 min read HTML | DOM Pre Object The DOM Pre Object is used to represent the HTML <pre> element. The pre element is accessed by getElementById().Properties: width: It is used to set or return the value of the width attribute of the pre element. Syntax: document.getElementById("ID"); Where âidâ is the ID assigned to the âpreâ 1 min read HTML | DOM Object Object The Object object represents only HTML <object> element. We can access any <object> element by using the getElementById(); and also can create object element by using createElement(); method.Syntax: It is used to access Object element document.getElementById("id"); It is used to create o 2 min read HTML DOM S Object The S Object in HTML DOM is used to represent the HTML <s> element. This tag is used to specify that the text content is no longer correct or accurate. The <s> element can be accessed by using the getElementById() method. Syntax: document.getElementById("id"); Where id is assigned to the 1 min read HTML | DOM Script Object The DOM Script Object is used to represent the HTML <script> element. The script element is accessed by getElementById(). Properties: async: It is used to specify the script is executed asynchronously. charset: It is used to specify the character encoding used in an external script file. defer 2 min read HTML | DOM Source Object The Source object in HTML represents an HTML element. An element can be accessed by using getElementById() and an element can be created by using the document.createElement() method. Properties of Source Object: media: This returns the value of the media attribute in a element. src: This returns the 2 min read HTML DOM Span Object The DOM span object is used to represent the HTML <span> element. The span element can be accessed by using the getElementById() method. Syntax: document.getElementById("id"); Where 'id' is the ID assigned to the span tag. Example 1: In the below program the content inside the span element is 1 min read HTML DOM Subscript Object The Subscript Object in HTML DOM is used to represent the HTML <sub> element. The subscript element can be accessed by using the getElementById() method. Syntax: document.getElementById("id") Where id is assigned to the <sub> tag. Example 1: In this example, we will use DOM Subscript Obj 1 min read Like