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:
$("#errormsg" ).html("Your information was entered incorrectly, please try again!").show(300).delay(3000).hide(300);
Method 2:
$("#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
Statement: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