A RetroSearch Logo

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

Search Query:

Showing content from https://webplatform.github.io/docs/apis/NodeList/length below:

length ยท WebPlatform Docs

length Summary

The number of nodes in the list.

Property of dom/NodeListdom/NodeList

Syntax

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

View live example

Related specifications
DOM Level 1
Recommendation
DOM
Working Draft

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