Skip to content
Fix Code Error

How to wait 5 seconds with jQuery?

March 13, 2021 by Code Error
Posted By: Anonymous

I’m trying to create an effect where the page loads, and after 5 seconds, the success message on the screen fades out, or slides up.

How can I achieve this?

Solution

Built in javascript setTimeout.

setTimeout(
  function() 
  {
    //do something special
  }, 5000);

UPDATE: you want to wait since when the page has finished loading, so put that code inside your $(document).ready(...); script.

UPDATE 2: jquery 1.4.0 introduced the .delay method. Check it out. Note that .delay only works with the jQuery effects queues.

Answered By: Anonymous

Related Articles

  • Error 'Map', but got one of type 'Null' flutter web…
  • sql query to find priority jobs
  • UnboundLocalError: local variable 'event' referenced…
  • What is Ember RunLoop and how does it work?
  • Pure JavaScript equivalent of jQuery's $.ready() -…
  • Text size and different android screen sizes
  • How to dispatch a Redux action with a timeout?
  • jQuery Mobile: document ready vs. page events
  • setTimeout function not working : javascript
  • How to use html template with vue.js
  • Python : Using Turtle-graphics, having issue with…
  • Watch $route.params.slug doesn't triggered vuejs
  • How to make the script wait/sleep in a simple way in unity
  • How do I return the response from an asynchronous call?
  • Multithreading: waiting for a thread to finish so I…
  • Vue.js, how to add/modify css class inside slot from parent
  • Running a cron every 30 seconds
  • load scripts asynchronously
  • VueJS masonry layout
  • The definitive guide to form-based website authentication
  • render function or template not defined in…
  • Problems with automating the function jquery
  • Why ActiveMQ Artemis auto delete address if all…
  • What does this symbol mean in JavaScript?
  • Lagging/Stutter performance box shadow based on…
  • How do I keep only the first map and when the game…
  • how to use canvas in JavaScript flappy bird code
  • Regex problem: find if error stack has "anonymous"…
  • Use Reveal.js with Polymer
  • How do I include a JavaScript file in another…
  • Any difference between await Promise.all() and…
  • Playing HTML5 video on fullscreen in android webview
  • "gatsby-source-airtable" threw an error while…
  • Am I paranoid? "Brutally" big Polymer website after…
  • How do I convert datetime.timedelta to minutes,…
  • Why does this method of detecting keypresses with…
  • How do i update a javascript variable as its value changes?
  • Load and execution sequence of a web page?
  • load and execute order of scripts
  • Start redis-server with config file
  • Vue.js: transition-group animation doesn't work
  • Android adding simple animations while…
  • How to implement `au run --watch` task + debugging
  • Minimal Example of Aurelia with Express
  • jQuery Uncaught TypeError: Property '$' of object…
  • The simplest possible JavaScript countdown timer?
  • Assigning properties value to an array in powershell
  • Discord.js: how can I make paticular permissons for…
  • YouTube iframe API: how do I control an iframe…
  • Live chat scraping (Youtube) with casper. Issue with…
  • Vue.js transition and transition-group animations…
  • When to use RabbitMQ over Kafka?
  • Why is my variable unaltered after I modify it…
  • How can you force the UI to update in the middle of…
  • How to correctly iterate through getElementsByClassName
  • Where should I put tags in HTML markup?
  • How to force Sequential Javascript Execution?
  • Efficient Algorithm for Bit Reversal (from…
  • Error stopping function after alert message is shown
  • Use of PUT vs PATCH methods in REST API real life scenarios
  • using setTimeout on promise chain
  • How to use Servlets and Ajax?
  • Trying to reduce repetition of HTML code using JavaScript
  • JavaScript TypeError: Cannot read property 'style' of null
  • JavaScript Loading Screen while page loads
  • Dynamic Components with Slots
  • RabbitMQ / AMQP: single queue, multiple consumers…
  • jest.fn() claims not to have been called, but has
  • Use a content script to access the page context…
  • Emit event from content in slot to parent
  • Javascript validate all checkboxes are selected
  • Android splash screen image sizes to fit all devices
  • How to display a loading template in Ember while…
  • Javascript - Reload page only after the effect are finished
  • Detect if page has finished loading
  • Delay content of test of Cloud Functions with Mocha
  • How to push to vue-router without adding to history?
  • Getting a loading scren to work with Polymer
  • Dynamically changing url in Backbone
  • Loading order for script inside body and using jquery ready
  • How do SO_REUSEADDR and SO_REUSEPORT differ?
  • Emberjs : how to display loading spinner and…
  • Vue equivalent of setTimeout?
  • Using the result of a query to display images inside…
  • How to create a game over screen for a basic HTML/JS game?
  • VueJS with normal JavaScript
  • Is it possible to apply CSS to half of a character?
  • Active tab issue on page load HTML
  • Vuejs route redirect on refresh
  • Emberjs will not load jquery/javascript, run code…
  • BackboneJs: Uncaught TypeError: undefined is not a function
  • My local server can't find bower files when I run my…
  • implement flask-healthz for python3
  • Delete all the queues from RabbitMQ?
  • How to use multiprocessing queue in Python?
  • how to scroll horizontal by button click like next…
  • How can I change the width and height of slides on…
  • Wait until page is loaded with Selenium WebDriver for Python
  • Ember.js Rendering template while waiting for data
  • Can I stop a User from returning to the previous…

Disclaimer: This content is shared under creative common license cc-by-sa 3.0. It is generated from StackExchange Website Network.

Post navigation

Previous Post:

File to byte[] in Java

Next Post:

grep a file, but show several surrounding lines?

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

.net ajax android angular arrays aurelia backbone.js bash c++ css dataframe ember-data ember.js excel git html ios java javascript jquery json laravel linux list mysql next.js node.js pandas php polymer polymer-1.0 python python-3.x r reactjs regex sql sql-server string svelte typescript vue-component vue.js vuejs2 vuetify.js

  • you shouldn’t need to use z-index
  • No column in target database, but getting “The schema update is terminating because data loss might occur”
  • Angular – expected call-signature: ‘changePassword’ to have a typedeftslint(typedef)
  • trying to implement NativeAdFactory imports deprecated method by default in flutter java project
  • What should I use to get an attribute out of my foreign table in Laravel?
© 2022 Fix Code Error