In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces how to use eq selector and eq() method in jquery, which has certain reference value. Interested friends can refer to it. I hope you will have a lot of harvest after reading this article. Let Xiaobian take you to understand it together.
:eq(index)
Matches an element with a given index value
index: counting from 0
$("ul li:eq(3)") //The index position of the element starts counting at 0, so the 3 here is actually the fourth element
$("ul").find("li").eq(3) //Traverse eq() using jquery
eq(index|-index)
Get the Nth element
index
An integer indicating the zero-based position of an element. The position of the element is zero-based.
-index
An integer indicating the position of an element, counting backwards from the last element in the collection. (counting from 1)
Get the second element of the match
This is just a test.
So is this
$("p").eq(1) or $("p").eq(-1)
Apply: tab tab
if
$('div.tab_box > div')//Select child node
.eq(index).show().siblings().hide();
This way you can achieve tab switching effect,
if $('div.tab_box > div:eq(index)')
.show().siblings().hide()
You can't switch.
Explanation:
: eq() selector to write variables, that is, index is dynamically changing, you need to use + + connection,
That is: $('div.tab_box > div:eq('+index+')')
Note: The quotation marks in front of yes are a pair, and the quotation marks behind them are a pair. It is also possible to use double quotation marks in front of a pair of quotation marks and single quotation marks behind them.
Both methods allow dynamic tab selection.
Thank you for reading this article carefully. I hope that Xiaobian will share the article "How to use eq selector and eq() method in jquery". This article is helpful to everyone. At the same time, I hope that everyone will support you a lot. Pay attention to the industry information channel. More relevant knowledge is waiting for you 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.