How jquery makes the element disappear in 3 seconds
This article mainly explains "how jquery makes elements disappear after 3 seconds". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how jquery makes elements disappear after 3 seconds".
Jquery makes the element disappear after 3 seconds: 1, use the delay () method to specify the delay time of the operation; 2, use the hide () method to hide the element after the specified delay time, and the syntax is "$(specified element) .delay (3000) .hide (300);".
The operating environment of this tutorial: windows10 system, jquery3.2.1 version, Dell G3 computer.
How to make the element disappear after 3 seconds by jquery
To achieve the effect that the element disappears after three seconds, you need to use the delay () method and the hide () method.
The delay () method sets the delay for the execution of the next item in the queue.
The syntax is:
$(selector) .delay (speed,queueName)
The hide () method is used to hide elements.
Let's take a look at how to make the element disappear after 3 seconds by using the above two methods, as shown in the following example:
(function () {$("# dianji") .click (function () {$("# disappare"). Delay (3000) .hide (300);}) Click
It will disappear automatically after clicking for 3 seconds.
Output result:
Thank you for your reading, the above is the content of "jquery how to make elements disappear after 3 seconds". After the study of this article, I believe you have a deeper understanding of how jquery makes elements disappear after 3 seconds, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!