A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/dom/Node/nodeName below:

nodeName ยท WebPlatform Docs

nodeName Summary

Gets the name of a particular type of node.

Property of dom/Nodedom/Node

Syntax

Note: 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.

Examples

The 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 specifications
DOM Level 3 Core
Recommendation
Attributions

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