How jquery hides a div
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!