Name
Element — Inherits Node
Synopsis
The Element interface represents a markup element. In
addition to its Node-like
methods, it supports access methods to get at contained
attributes.
tagNameThe name of the element type. In
<stag drums="dale">, a string with the valuestagis returned.getAttribute(name)This method returns an attribute’s value. This method bypasses retrieving the
Attrobject directly and using its accessor methods. In some cases, using theAttrnode directly may be more appropriate, but the convenience methods on the element node usually suffice.getAttributeNS(namespaceURI, localName)Similar to
getAttribute, but selects the return attribute based on namespace as well as name.getAttributeNode(name)This method returns the actual
Attrobject instead of its character value, as is the case withgetAttribute. ReturnsNoneif no such attribute is found.getAttributeNodeNS(namespaceURI, localName)Returns an
Attrnode that matches both the name and namespace URI specified. ReturnsNoneif no such attribute is found.getElementsByTagName(tagName)This method returns a
NodeListof descendantElementnodes that share the same element type name. The special value*matches all tags.getElementsByTagNameNS(namespaceURI, localName)Returns a
NodeListof all descendant elements who match both the name and namespace URI supplied. The value*in either field matches all namespaces URIs or all local names; using*for both fields matches all elements in the tree rooted at this ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access