How jquery modifies the hidden property
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.