The HTML DOM Document Object

When an HTML document is loaded into a web browser, it becomes a document object. The document object is the root node of the HTML document. Document Object Properties and Methods The following properties and methods can be used on HTML documents: Property / Method Description activeElement Returns the currently focused element in the document addEventListener() […]

The HTML DOM Attribute Object

The Attr Object In the HTML DOM, the Attr object represents an HTML attribute. An HTML attribute always belongs to an HTML element. The NamedNodeMap Object In the HTML DOM, the NamedNodeMap object represents an unordered collection of an elements attribute nodes. Nodes in a NamedNodeMap can be accessed by name or by index (number). Properties and Methods Property […]

HTML DOM Bold Object

Bold Object The Bold object represents an HTML <b> element. Access a Bold Object You can access a <b> element by using getElementById(): Example var x = document.getElementById(“myB”); Try it Yourself » Create a Bold Object You can create a <b> element by using the document.createElement() method: Example var x = document.createElement(“B”); Try it Yourself » Standard […]

HTML DOM Audio Object

Audio Object  The Audio Object is new in HTML5. The Audio object represents an HTML <audio> element. Note: The <audio> element is not supported in Internet Explorer 8 and earlier versions. Access an Audio Object You can access an <audio> element by using getElementById(): Example var x = document.getElementById(“myAudio”); Try it Yourself » Create an Audio Object […]

The HTML DOM Element Object

In the HTML DOM, the Element object represents an HTML element, like P, DIV, A, TABLE, or any other HTML element. Properties and Methods The following properties and methods can be used on all HTML elements: Property / Method Description accessKey Sets or returns the accesskey attribute of an element addEventListener() Attaches an event handler to the […]

HTML DOM Style Object

Style object The Style object represents an individual style statement. Style Object Properties The “CSS” column indicates in which CSS version the property is defined (CSS1, CSS2, or CSS3). Property Description CSS alignContent Sets or returns the alignment between the lines inside a flexible container when the items do not use all available space 3 […]

HTML DOM Section Object

Section Object  The Section Object is new in HTML5. The Section object represents an HTML <section> element. Note: The <section> element is not supported in Internet Explorer 8 and earlier versions. Access a Section Object You can access a <section> element by using getElementById(): Example var x = document.getElementById(“mySection”); Try it Yourself » Create a Section Object […]

HTML DOM Select Object

The Select object represents an HTML <select> element. Access a Select Object You can access a <select> element by using getElementById(): Example var x = document.getElementById(“mySelect”); Try it Yourself » Tip: You can also access a Select object by searching through the elements collection of a form. Create a Select Object You can create a <select> element by using […]

HTML DOM Small Object

Small Object The Small object represents an HTML <small> element. Access a Small Object You can access a <small> element by using getElementById(): Example var x = document.getElementById(“mySmall”); Try it Yourself » Create a Small Object You can create a <small> element by using the document.createElement() method: Example var x = document.createElement(“SMALL”); Try it Yourself » Standard […]

HTML DOM Source Object

Source Object  The Source Object is new in HTML5. The Source object represents an HTML <source> element. Access a Source Object You can access a <source> element by using getElementById(): Example var x = document.getElementById(“mySource”); Try it Yourself » Create a Source Object You can create a <source> element by using the document.createElement() method: Example var x […]

HTML DOM Script Object

The Script object represents an HTML <script> element. Access a Script Object You can access a <script> element by using getElementById(): Example var x = document.getElementById(“myScript”); Try it Yourself » Tip: You can also access a <script> element by using the scripts collection. Create a Script Object You can create a <script> element by using the document.createElement() method: Example […]

HTML DOM S Object

S Object The S object represents an HTML <s> element. Access a S Object You can access a <s> element by using getElementById(): Example var x = document.getElementById(“myS”); Try it Yourself » Create a S Object You can create a <s> element by using the document.createElement() method: Example var x = document.createElement(“S”); Try it Yourself » Standard […]

HTML DOM Progress Object

Progress Object  The Progress Object is new in HTML5. The Progress object represents an HTML <progress> element. The <progress> element represents the progress of a task. Access a Progress Object You can access a <progress> element by using getElementById(): Example var x = document.getElementById(“myProgress”); Try it Yourself » Create a Progress Object You can create a […]

HTML DOM Pre Object

Pre Object The Pre object represents an HTML <pre> element. Access a Pre Object You can access a <pre> element by using getElementById(): Example var x = document.getElementById(“myPre”); Try it Yourself » Create a Pre Object You can create a <pre> element by using the document.createElement() method: Example var x = document.createElement(“PRE”); Try it Yourself » Pre […]

HTML DOM Strong Object

Strong Object The Strong object represents an HTML <strong> element. Access a Strong Object You can access a <strong> element by using getElementById(): Example var x = document.getElementById(“myStrong”); Try it Yourself » Create a Strong Object You can create a <strong> element by using the document.createElement() method: Example var x = document.createElement(“STRONG”); Try it Yourself » Standard […]

HTML DOM Parameter Object

Parameter Object The Parameter object represents an HTML <param> element. The <param> element is used to define parameters for plugins embedded with an <object> element. Access a Parameter Object You can access a <param> element by using getElementById(): Example var x = document.getElementById(“myParam”); Try it Yourself » Create a Parameter Object You can create a <param> […]

HTML DOM Output Object

Output Object  The Output Object is new in HTML5. The Output object represents an HTML <output> element. Note: The <output> element is not supported in Internet Explorer / Edge. Access an Output Object You can access an <output> element by using getElementById(): Example var x = document.getElementById(“myOutput”); Try it Yourself » Tip: You can also access an <output> […]

HTML DOM Option Object

Option Object The Option object represents an HTML <option> element. Access an Option Object You can access an <option> element by using getElementById(): Example var x = document.getElementById(“myOption”); Try it Yourself » Tip: You can also access an Option object by searching through the elements collection of a form, or the options collection of a drop-down list. Create an Option Object […]

HTML DOM Summary Object

Summary Object  The Summary Object is new in HTML5. The Summary object represents an HTML <summary> element. Note: The <summary> element is currently only supported in Chrome, Safari 6+ and Opera 15+. Access a Summary Object You can access a <summary> element by using getElementById(): Example var x = document.getElementById(“mySummary”); Try it Yourself » Create a Summary […]

HTML DOM Superscript Object

Superscript Object The Superscript object represents an HTML <sup> element. Access a Superscript Object You can access a <sup> element by using getElementById(): Example var x = document.getElementById(“mySup”); Try it Yourself » Create a Superscript Object You can create a <sup> element by using the document.createElement() method: Example var x = document.createElement(“SUP”); Try it Yourself » Standard […]