Detailed explanation of this articlejqueryandjsHow to hide and display div
jquery and js can hide and display p respectively, and the methods are also different Same, jquery's show, show; js's hidden, visible
jQuery's display and hiding of p:
Display:
The code is as follows:
$("#id").show()
Hide:
The code is as follows:
$("#id").show()
js displays and hides p:
p visibilityYou can control the display and hiding of p, but the page will be blank after hiding it
The code is as follows:
style="visibility: none;" document.getElementById("typep1").style.visibility="hidden";//隐藏 document.getElementById("typep1").style.visibility="visible";//显示
Passed Setting the display attribute can release the occupied page space after p is hidden, as follows
The code is as follows:
style="display: none;" document.getElementById("typep1").style.display="none";//隐藏 document.getElementById("typep1").style.display="";//显示
The above is the detailed content of Detailed explanation of how jquery and js implement hiding and displaying divs. For more information, please follow other related articles on the PHP Chinese website!