The length property
The length property gets the number of elements in the set.
Syntax
.length;
Example
Let's find all the paragraphs and count their number:
<p>text</p>
<p>text</p>
<p>text</p>
<p>text</p>
<p>text</p>
let num = $('p').length;
alert(num);
See also
-
method
index,
which gets the number of elements in a set