In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces jquery how to modify the style attribute to hide the element of related knowledge, the content is detailed and easy to understand, the operation is simple and fast, with a certain reference value, I believe you will have something to gain after reading this jquery how to modify the style attribute to hide the element article, let's take a look at it.
Two hiding methods: 1, use css () to control display style, syntax "element object .css ('display','none')"; 2, use attr () to control display style, syntax "element object .attr (' style','display:none')".
The operating environment of this tutorial: windows7 system, jquery1.10.2 version, Dell G3 computer.
Two ways for jquery to modify the style attribute to hide an element
Css () method
Attr () method
1. Use the css () method
Use css () to control the display or visibility style, syntax:
Element object .css ('display','none'); / / hide element object .css (' visibility','hidden'); / / element hiding
Example:
.siblings * {display: block; border: 2px solid lightgrey; color: lightgrey; padding: 5px; margin: 15px } .start {color: peru } $(document) .ready (function () {$("button") .click (function () {$("p") .css ('display','none')) / / hide $("div") .css ('visibility','hidden'); / / element hiding});})
A p element
A div element
A p element
Hidden element
2. Use the attr () method
Use attr () to control the display or visibility style, syntax:
Element object .attr ('style','display:none'); / / hide element object. Attr (' style','visibility:hidden'); / / element hide
Example:
$(document) .ready (function () {$("button") .click (function () {$("p"). Attr ('style','display:none'); / / hide $("div"). Attr (' style','visibility:hidden'); / / element hiding});})
This is the end of the article on "how jquery modifies the style attribute to hide elements". Thank you for reading! I believe you all have a certain understanding of "how jquery modifies style attributes to hide elements". 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.