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 hidden property

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

Share

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

This article mainly introduces jquery how to modify hidden properties of the relevant knowledge, the content is detailed and easy to understand, simple and fast operation, has a certain reference value, I believe that everyone after reading this jquery how to modify hidden properties of the article will have a harvest, let's take a look at it.

Methods: 1, with attr (), syntax "element object .attr (" hidden ", value)"; 2, with prop (), syntax "element object .prop (" hidden ", value)"; 3, with removeAttr (), syntax "element .removeAttr (" hidden ")".

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

The hidden attribute specifies that the element is hidden. Hidden elements are not displayed. If you use this attribute, the element is hidden.

Jquery modifies hidden property

1. Use the attr () property to set the value of the hidden property

$(document) .ready (function () {$("button") .click (function () {$("div"). Attr ("hidden", false);})

Test text-p element

Test text-div element

Test text-p element

Modify the hidden property

2. Set the value of the hidden property with the prop () attribute

$(document) .ready (function () {$("button") .click (function () {$("div"). Prop ("hidden", false);})

Test text-p element

Test text-div element

Test text-p element

Modify the hidden property

The running effect is the same as method 1.

3. Delete the hidden attribute with the removeAttr () attribute

$(document) .ready (function () {$("button") .click (function () {$("div"). RemoveAttr ("hidden");})

Test text-p element

Test text-div element

Test text-p element

Modify the hidden property

The running effect is the same as method 1.

This is the end of the article on "how jquery modifies hidden properties". Thank you for reading! I believe you all have a certain understanding of "how jquery modifies hidden properties". If you want to learn more, you are welcome to follow 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.

Share To

Development

Wechat

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

12
Report