The length property in jQuery
To find out the number of elements in a set, use the length property.
For example, we have the following HTML code:
<p>text</p>
<p>text</p>
<div>text</div>
<p>text</p>
<p>text</p>
<div>text</div>
Let's find out the number of paragraphs and output it to the console:
let num = $('p').length;
console.log(num);
Get the number of elements li.