The number of nodes in the list.
Property of dom/NodeListdom/NodeList
SyntaxNote: This property is read-only.
var result = list.length;
Return Value
Returns an object of type unsigned longunsigned long
Examples
<ul>
<li class="fruit">Apple</li>
&li;class="fruit">Banana</li>
<li class="fruit">Cherry</li>
</ul>
<div id="fruit"></div>
<script>
var fruitNodes = document.querySelectorAll('.fruit');
var fruitNodeCount = fruitNodes.length;
document.getElementById('fruit').innerHTML = 'Number of fruit nodes: ' + fruitNodeCount;
</script>
Related specifications
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