Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How jquery hides a column element

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article focuses on "how jquery hides a column of elements". Interested friends may wish to take 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 jquery hides a list of elements.

Method: 1, use the ": nth-child" selector and "$(element)" statement to get a column of element objects that you want to hide, the syntax is "$(element: nth-child (n))"; 2, use the hide () method to hide the element object, and the syntax is "element object .hide ()".

The operating environment of this tutorial: windows7 system, jquery1.10.0 version, Dell G3 computer.

How jquery hides a column of elements

In jquery, you can get the specified column object through the "td:nth-child (2)" object selector and hide it using the hide () method. Here is an example of how jquery hides the columns in a table.

1. Create a new html file, named test.html, to explain how jquery hides the columns in the table. Create a four-row and two-column table using the table tag and set its border to 1px. Add an id attribute mytable to the table table to get the table object below.

In the test.html file, create a button button, bind the onclick click event to button, and execute the hidelie () function when the button is clicked.

2, in the js tag, create the hidelie () function, in the function, through the "td:nth-child (2)" object selector to get the second column of objects, using the hide () method to achieve hiding.

Open the test.html file in the browser and click the button to see the effect of the implementation.

After clicking the button:

At this point, I believe you have a deeper understanding of "how jquery hides a column of elements". 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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report