Home > Web Front-end > JS Tutorial > body text

jquery and js implement methods to hide and show divs_jquery

WBOY
Release: 2016-05-16 16:35:21
Original
1012 people have browsed it

jQuery showing and hiding divs:

Display:

Copy code The code is as follows:

$("#id").show()

Hide:
Copy code The code is as follows:

$("#id").show()

JS shows and hides divs:

The visibility of the div can control the display and hiding of the div, but the page will appear blank after hiding it

Copy code The code is as follows:

style="visibility: none;"

document.getElementById("typediv1").style.visibility="hidden";//Hide

document.getElementById("typediv1").style.visibility="visible";//Display

By setting the display attribute, you can hide the div and release the occupied page space, as follows

Copy code The code is as follows:

style="display: none;"

document.getElementById("typediv1").style.display="none";//Hide

document.getElementById("typediv1").style.display="";//Display
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template