The Element object represents an element in the HTML document.
The Element object can have child nodes of type Element, Text, Comment, CDATASection, ProcessingInstruction, and EntityReference.
The Element object can have attributes, which have the node type Attr.
Note: The Element object can also use the properties and methods of the Node object.
![]()
The Element object is supported in all major browsers.
The "DOM" column indicates in which DOM Level the property was introduced.
| Property | Description | DOM |
|---|---|---|
| schemaTypeInfo | Returns the type information of the element. | 3 |
| tagName | Returns the tag name of the element | 1 |
The "DOM" column indicates in which DOM Level the method was introduced.
| Method | Description | DOM |
|---|---|---|
| getAttribute() | Returns the specified attribute value | 1 |
| getAttributeNS() | Returns the specified attribute value, with the specified namespace. For XML DOM only | 2 |
| getAttributeNode() | Returns the specified attribute node | 1 |
| getAttributeNodeNS() | Returns the specified attribute node, with the specified namespace. For XML DOM only | 3 |
| getElementsByTagName() | Returns a collection of all child elements with the specified tagname | 1 |
| getElementsByTagNameNS() | Returns a collection of all child elements with the specified tagname and namespace. For XML DOM only | 2 |
| hasAttribute() | Returns true if the element has the specified attribute, otherwise it returns false | 2 |
| hasAttributeNS() | Returns true if the element has the specified attribute, with the specified namespace, otherwise it returns false. For XML DOM only | 2 |
| removeAttribute() | Removes the specified attribute | 1 |
| removeAttributeNS() | Removes the attribute with the specified name and namespace. For XML DOM only | 2 |
| removeAttributeNode() | Removes the specified attribute node, and returns the removed node | 1 |
| setAttribute() | Sets or changes the specified attribute, to the specified value | 1 |
| setAttributeNS() | Sets or changes the specified attribute, with the specified namespace, to the specified value. For XML DOM only | 2 |
| setAttributeNode() | Sets or changes the specified attribute node | 1 |
| setAttributeNodeNS() | Sets or changes the specified attribute node | 2 |
| setIdAttribute() | 3 | |
| setIdAttributeNS() | 3 | |
| setIdAttributeNode() | 3 |
The perfect solution for professionals who need to balance work, family, and career building.
More than 10 000 certificates already issued!
The HTML Certificate documents your knowledge of HTML.
The CSS Certificate documents your knowledge of advanced CSS.
The JavaScript Certificate documents your knowledge of JavaScript and HTML DOM.
The jQuery Certificate documents your knowledge of jQuery.
The XML Certificate documents your knowledge of XML, XML DOM and XSLT.
The ASP Certificate documents your knowledge of ASP, SQL, and ADO.
The PHP Certificate documents your knowledge of PHP and SQL (MySQL).
| WEB HOSTING |
|---|
| Best Web Hosting |
| PHP MySQL Hosting |
| Best Hosting Coupons |
| UK Reseller Hosting |
| Cloud Hosting |
| Top Web Hosting |
| $3.98 Unlimited Hosting |
| Premium Website Design |
| WEB BUILDING |
|---|
| Download XML Editor |
| FREE Website BUILDER |
| Best Website Templates Top CSS Templates |
| CREATE HTML Websites |
| EASY WEBSITE BUILDER |
| W3SCHOOLS EXAMS |
|---|
|
Get Certified in: HTML, CSS, JavaScript, XML, PHP, and ASP |
| W3SCHOOLS BOOKS |
|---|
|
New Books: HTML, CSS JavaScript, and Ajax |
| STATISTICS |
|---|
|
Browser Statistics Browser OS Browser Display |
| SHARE THIS PAGE |
|---|