Home>Article>Web Front-end> How to hide a div in jquery
Jquery method to hide a div: 1. Use the "$("div").hide();" statement to hide; 2. Use the "$("div").toggle();" statement Hide; 3. Use the "$("div").css("display","none");" statement to hide.
The operating environment of this tutorial: windows7 system, jquery1.10.2 version, Dell G3 computer.
jquery method to hide div
Method 1: Use hide() method
hide () method can hide selected elements.
这是一个标题
这是一个div元素。这是另一个段落。
Method 2: Use the toggle() method
toggle() method to switch the visible state of the element.
If the selected elements are visible, then hide these elements. If the selected elements are hidden, then display these elements.
这是一个标题
这是一个div元素。这是另一个段落。
Method 3: Use the CSS() method to set the display attribute to the element
这是一个标题
这是一个div元素。这是另一个段落。
[Recommended learning:jQuery video tutorial,web front-end video】
The above is the detailed content of How to hide a div in jquery. For more information, please follow other related articles on the PHP Chinese website!