jQuery setTimeout

Posted on 2014-11-06
Last Modified: 2014-11-06
Hello Experts,

I am using the "setTimeout" function to add a class to a preloader element.
I want to remove the element from the page after 1s.

The first code is the initial and the second is what does not work for removing the element.

Can you please let me know how to "callback" after the 1s and remove the "#loader" element from the DOM?

setTimeout(function() {
 } ,1000);

Open in new window

setTimeout(function() {
 } ,1000, function() {

Open in new window

Question by:Refael
  • 2
LVL 82

Accepted Solution

leakim971 earned 500 total points
ID: 40427164
use two instead one :

setTimeout(function() {
 } ,1000);
setTimeout(function() {
 } ,2000);

Open in new window


Author Closing Comment

ID: 40427183
leakim971 as always you are a star :-)
I thought there is a way to combine one function with the "remove". Okay i will have two functions instead.
Many thanks!!!

Author Comment

ID: 40427184

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
HTML and CSS for a complex page 20 57
Jquey and footrable 2 34
Angular- another way of coding hide and display 3 36
Recordset containing single quotes 8 19
Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question ( on how to make a page show some balloons animate up a page…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now