Gets the name of a particular type of node.
SyntaxNote: This property is read-only.
var nodeName = node.nodeName;
Return Value
Returns an object of type StringString
The uppercase name of the node if Content type is text/html, else the lowercase name of the node if Content type is xhtml or any other xml content type.
ExamplesThe following code example uses the nodeName property to obtain the name of an element.
<body>
<ul id="oList">
<li>List Item 1</li>
<li>List Item 2</li>
<li>List Item 3</li>
</ul>
<script type="text/javascript">
var sName = document.getElementById("oList").childNodes(1).nodeName;
</script>
</body>
Notes
The html spec allows tag names of either case, upper or lower-case. The xhtml spec requires tag names in lower-case only. For interoperability between html and xhtml, and for markup re-use in html and xhtml documents user lower-case tag names in your source markup.
Using lower-case tag names in your source markup also require less keystrokes!
Read more details on nodeName case sensitivity in different browsers.
Related specificationsMozilla Developer Network : [Node.nodeName Article]
Microsoft Developer Network: [nodeName Property Article]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4