In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
In this article, the editor introduces in detail "jquery how to judge how to be selected", detailed content, clear steps, and proper handling of details. I hope this article "jquery how to judge how to be selected is the first one" can help you solve your doubts.
In jquery, you can use the index () method to determine which element is selected, which is used to return the index position of the specified element relative to other specified elements, with the syntax of "specified element object .index (this)".
The operating environment of this tutorial: windows10 system, jquery3.2.1 version, Dell G3 computer.
How does jquery judge which one is chosen?
Suppose you have a piece of HTML code like this:
JQuery determines the number of elements the current element is example jQuery gets the Nth element example jQuery selector example
JQuery determines which element the current element is.
If we click on any of the li tags and want to know which li tag we are clicking on, we can use the following code:
$("ul li") .click (function () {var index = $("ul li") .index (this); alert (index);})
Such as the above jQuery code, if the first click will prompt "0", if it is the second li tag will prompt "1", note that the index serial number starts at 0.
The index () method returns the index position of the specified element relative to other specified elements.
These elements can be specified through jQuery selectors or DOM elements.
Note: if no element is found, index () returns-1.
After reading this, the article "how to judge which jquery is selected" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself. If you want to know more about related articles, welcome to follow the industry information channel.
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.