In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
Most people do not understand the knowledge points of this article "jquery how to judge which column to click on", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "jquery how to judge which column is clicked" article.
Method: 1, use "element .click (function () {})" to bind the click event to the element, and set the handler function; 2, in the function, use the "$(this). Index () + 1" statement to get the number of rows of the click element. The element positions obtained by index () are counted from 0 and need to be processed by adding 1.
The operating environment of this tutorial: windows7 system, jquery1.10.2 version, Dell G3 computer.
Jquery determines which column is clicked.
Realize the idea:
Bind the click event to the element with click () and set the event handler
In the processing function, use index () to get the location of the clicked element and the number of rows of the clicked element
Note: the element positions obtained by index () are counted from 0 and need to be processed by adding 1.
Implementation code:
Tr:nth-of-type (even) {background-color: red;} tr:nth-of-type (odd) {background-color: pink } $(document) .ready (function () {$("tr") .click (function () { Console.log ("is the first of the table" + ($(this) .index () + 1) + "column") );}) Commodity price T-shirt ¥100 cowboy coat ¥250 jeans library ¥150
Determine which column of the table the click column is.
Description:
The element position obtained by the index () method starts at 0, so if you want to get the exact number of rows, you need to calculate and add 1 to the value.
The above is about the content of this article on "how to determine which column to click on by jquery". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more related knowledge, please pay attention to 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.