Return a collection of all elements with the specified namespace and tagname :
The getElementsByTagNameNS() method returns a collection of all elements in the document with the specified tagname, and with the specified namespace, as a NodeList object.
Read more about the NodeList object in our NodeList object reference.
Tip: The tagname parametervalue "*" matches all tagnames in the document.
Tip: The namespaceURI parametervalue "*" matches all namespaceURI's in the document.
![]()
The getElementsByTagNameNS() method is supported in all major browsers.
Note: Internet explorer 8 and earlier does not support this method.
| Parameter | Type | Description |
|---|---|---|
| namespaceURI | String | Required. The namespaceURI of the elements you want to get |
| tagname | String | Required. The tagname of the elements you want to get |
| Type | Description |
|---|---|
| NodeList object | A collection of elements with the specified namespace, and tagname |
| DOM Version | Core Level 2 |
|---|
Your message has been sent to W3Schools.