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 jquery shows hidden div layers

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

Share

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

This article will explain in detail how jquery shows hidden div layers, Xiaobian thinks it is very practical, so share it for everyone to make a reference, I hope you can gain something after reading this article.

jquery Show hidden div layer method: 1, create a button and bind a click event to the button, and specify the event handling function;2, in the event handling function using the show() method can show hidden div, syntax is "div element object.show()".

Operating environment for this tutorial: Windows 10 system, jquery version 3.2.1, Dell G3 computer.

jquery How to show hidden div layers

In jquery, by getting the div element object, the hidden div can be displayed using the show() method.

Create a new html file named test.html that explains how to use jquery to make a hidden div visible. Use div to create a module and set its id to test, mainly for the following use to get div objects from that id.

Define the style of div, set its display attribute to none, realize hiding, at the same time, use the width attribute to set the width of div to 100px, use the height attribute to set the height of div to 100px, and use the background attribute to set the background color of div to red.

Use the button tag to create a button with the name "Show hidden div." Binds an onclick event to the button, and executes the showdiv () function when the button is clicked.

Create showdiv() function, inside the function, get div object by id(test), use show() method to show hidden div content.

Open the test.html file in your browser and click on the button to see how it works.

After clicking the button:

Summary:

Create a test.html file.

2. Within the file, use div to create a module, and use css to set div invisible.

Create a button that triggers the execution of the JS function.

4, in the js tag, create a function, in the function, through the id(test) to obtain the div object, use the show() method to achieve the hidden div content displayed.

precautions

In addition to the above methods, you can also use the css() method to set the div's display attribute to block, so that the hidden div can be displayed.

About "jquery how to display hidden div layer" this article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it to let more people see.

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: 0

*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