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 to use jquery to operate the display of div in html

2025-01-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly shows you "how to use jquery in html to operate the display of div", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use jquery in html to operate the display of div" this article.

Examples

Div hide test hide or show

The content of div

("# controller") .click (function () {if ($("# contents"). Is (": hidden")) {$("# contents") .show ()} else {$("# contents") .hide ()})

Jqyery operation

$("# contents") .is (": hidden") can determine whether it is hidden or not

$("# contents") .show () represents display:block

$("# contents") .hide () represents display:none

Column

\ u7f51\ u7ad9\ u5f00\ u53d1\ u5fc5\ u5b66\ u4e4bHTML\ u8bed\ u8a00

Author:\ u521d\ u5b66\ u8005\ u4e4b\ u8def\ u5f20\ u8001\ u5e08

28 yuan

12 people have purchased

View

Manipulate the attributes of an element

$("# contents"). Attr ("style", "display:none;"); / / hide div

$("# contents"). Attr ("style", "display:block;"); / / display div

You can also manipulate the css property

$("# contents"). Css ("display", "none"); / / hide div

$("# contents"). Css ("display", "block"); / / display div

It can also be implemented directly using the toggle conversion switch.

("# contents") .toggle ()

The above is all the contents of the article "how to use jquery to operate the display of div in html". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more 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: 211

*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