Get the App
SLTechnology News&Howtos  ›  Development  › 

How jquery modifies the visibility property

Shulou Source: shulou.com Published: 2022-06-01 11:06:08 10月04日 Update

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!

Tags: Attributes methods paragraphs elements content examples tables grammar learning practical deeper line interest practicality reality layout easy to operate tutorials more friends Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux OPPO Reno Shulou Technology vpn Docker