Home  >  Article  >  Web Front-end  >  How to get how many li there are in jquery

How to get how many li there are in jquery

藏色散人
藏色散人Original
2021-11-17 11:00:572725browse

How to get the number of li in jquery: 1. Create an HTML sample file; 2. Introduce the jquery library; 3. Get the li through the "$("#questionUl li").length;" method.

How to get how many li there are in jquery

The operating environment of this article: Windows 7 system, jquery version 3.2.1, DELL G3 computer

How to get how many li there are in jquery?

JS/Jquery gets how many li tags there are under the current UL tag

 
  • 1
  • 2
  • 3
  • 4

1. js method

2.jQuery method

var lengli = $("#questionUl li").length;

Recommended learning: "jquery video tutorial"

The above is the detailed content of How to get how many li there are in jquery. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn