In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to get the li of jquery". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to get how much li jquery has".
Jquery to get the number of li method: 1, use the "$('li')" statement to get the li object; 2, use the length attribute to calculate the length of the li object, you can get the number of li elements in the document, the syntax is "li object .length;".
The operating environment of this tutorial: windows7 system, jquery1.10.0 version, Dell G3 computer.
Jquery's method of getting how many li there are
1. Create a new html file named test.html, which is used to explain how jquery obtains the number of li under ul. Use the ul tag to create a list of items for testing. Add a class attribute to the ul tag to get the ul object.
Use the button tag to create a button that binds button to an onclick click event, and executes the getLength () function when the button is clicked.
2, create the getLength () function, within the function, get the li object through class, use the length attribute to get the number of li, and use the alert () method to output the number.
Open the test.html file in the browser and click the button to view the results.
At this point, I believe you have a deeper understanding of "how much li is obtained by jquery". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.