DOM HTMLCollection

An HTMLCollection object is an array-like list of HTML elements. Methods like the getElementsByTagName() returns an HTMLCollection. Properties and Methods The following properties and methods can be used on a HTMLCollection object: Property / Method Description item() Returns the element at the specified index in an HTMLCollection length Returns the number of elements in an […]

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() […]

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 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 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 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 Textarea Object

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

HTML DOM Ins Object

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

HTML DOM Code Object

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

HTML DOM Base Object

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

HTML DOM Area Object

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

HTML DOM Address Object

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