How to use jquery to display elements by clicking on them and then click on hidden elements again

WBOY
Release: 2021-11-22 16:31:53
Original
7082 people have browsed it

Method: 1. Use the click() method to bind the click event to the button and specify the processing function; 2. Use if statements, show() and hide() in the function to implement the syntax "if(element object .is(':hidden')){element object.show();}else{element object.hide();}".

How to use jquery to display elements by clicking on them and then click on hidden elements again

The operating environment of this tutorial: windows7 system, jquery1.10.0 version, Dell G3 computer.

jquery How to click to display an element and click to hide an element again

In jquery, you can use the show() method and hide() method to Click the button to display and click to hide again. The hide() method hides the selected element if it has been displayed. The syntax is:

$(selector).hide(speed,callback)
Copy after login

show() method. If the selected elements have been hidden, these elements are displayed. The syntax is:

$(selector).show(speed,callback)
Copy after login

Let’s take an example to see how to implement the county Click to hide the level display again. The example is as follows:

   
   
Copy after login

Output result:

How to use jquery to display elements by clicking on them and then click on hidden elements again

## Recommended related video tutorials:

jQuery video tutorial

The above is the detailed content of How to use jquery to display elements by clicking on them and then click on hidden elements again. For more information, please follow other related articles on the PHP Chinese website!

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!