Home > Web Front-end > JS Tutorial > Example of usage of hide() method in jQuery_jquery

Example of usage of hide() method in jQuery_jquery

WBOY
Release: 2016-05-16 16:24:46
Original
1139 people have browsed it

The example in this article describes the usage of the hide() method in jQuery. Share it with everyone for your reference. The specific analysis is as follows:

This method can hide matching elements.

Usage of hide() method:
If this method does not impose a time limit on the hiding effect, the matching elements will be hidden instantly. For example:

Copy code The code is as follows:
$("div").hide()

The above code can hide all div elements instantly.
If the method time-limits the hiding effect, then the matching element will be hidden in a more elegant form within the limited event. For example:
Copy code The code is as follows:
$("div").hide(2000)

The above code can hide all div elements within 2000 milliseconds (2 seconds).
This method can also trigger a callback function after hiding is complete. For example:
Copy code The code is as follows:
$("div").hide(2000,function(){alert(" I've hidden it")});

Example code:

Copy code The code is as follows:






hide() function-Script Home











The above code can trigger the callback function after the hiding is completed, so a prompt box will pop up.

I hope this article will be helpful to everyone’s jQuery programming.

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