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 modifies the visibility property

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article focuses on "how jquery modifies visibility properties". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how jquery modifies visibility properties.

Modification method: 1, use css () method, syntax "$(selector) .css (" visibility "," new value ")"; 2, use attr () method, syntax "$(selector) .attr (" style "," visibility: new value; ")".

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

The visibility attribute specifies whether the element is visible. Property values that can be set:

The value describes the visible default value. The element is visible. The hidden element is invisible. Collapse this value deletes a row or column when used in a table element, but it does not affect the layout of the table. The space occupied by rows or columns is reserved for other content. If this value is used on other elements, it will be rendered as "hidden".

Jquery modifies visibility property

1. Use the css () method

$(selector) .css ("visibility", "new value")

Example:

$(document) .ready (function () {$("button") .click (function () {$("# box"). Css ("visibility", "hidden");})

Visible paragraph

Visible paragraph

Visible paragraph

Modify the visibility property

2. Use the attr () method

$(selector) .attr ("style", "visibility: new value;")

Example:

$(document) .ready (function () {$("button") .click (function () {$("# box"). Attr ("style", "visibility:visible;");})

Visible paragraph

Hidden paragraphs

Visible paragraph

Modify the visibility property

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