Home > Web Front-end > JS Tutorial > Specific implementation of jquery prompt information automatically disappearing after being displayed_jquery

Specific implementation of jquery prompt information automatically disappearing after being displayed_jquery

WBOY
Release: 2016-05-16 17:08:24
Original
1497 people have browsed it

It is often necessary to make a prompt message display for a few seconds and then disappear automatically. I used to use setTimeout to achieve this, but I found that it is not good if there are multiple setTimeouts on the page. Today I found two very simple methods. Mark them.
Method 1:

Copy code The code is as follows:

$("#errormsg" ).html("Your information was entered incorrectly, please try again!").show(300).delay(3000).hide(300);

Method 2:
Copy code The code is as follows:

$("#errormsg").html("ok").hide( 3000);//This is gradually disappearing
$("#errormsg").html("ok").fadeTo(3000).hide(); //This is for it to be displayed for 5 seconds (actually there is no change transparency) and then hide
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