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 hides a div

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

Share

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

This article mainly introduces how jquery hides a div. It is very detailed and has a certain reference value. Friends who are interested must read it!

Jquery hide a div method: 1, use "$(" div "). Hide ();" statement hide; 2, use "$(" div "). Toggle ();" statement hide; 3, use "$(" div "). Css (" display "," none ");" statement hide.

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

The method of hiding div in jquery

Method 1: use the hide () method

The hide () method hides the selected element.

$(document) .ready (function () {$("button") .click (function () {$("div"). Hide ();}) This is a title. This is a div element.

This is another paragraph.

Delete div element

Method 2: use the toggle () method

The toggle () method toggles the visible state of the element.

If the selected elements are visible, they are hidden, and if they are hidden, they are displayed.

$(document) .ready (function () {$("button") .click (function () {$("div"). Toggle ();}) This is a title. This is a div element.

This is another paragraph.

Hide or show div elements

Method 3: use the CSS () method to set the display attribute for the element

$(document) .ready (function () {$("button") .click (function () {$("div") .css ("display", "none"); / / hide div});}) This is a title. This is a div element.

This is another paragraph.

Hide div elements

The above is all the content of the article "how jquery hides a div". Thank you for reading! Hope to share the content to help you, more related knowledge, 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