Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 668141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:00:26+00:00 2026-05-14T00:00:26+00:00

Sample jquery. Assume $cog is a cached selector of multiple items. $cog.fadeOut(‘slow’,function(){ alert(‘hey’); })

  • 0

Sample jquery. Assume $cog is a cached selector of multiple items.

$cog.fadeOut('slow',function(){
    alert('hey');
})

In that example, of $cog is a jQuery object of 4 DOM elements, the above will fade each element out one by one, and trigger an alert each time on the callback (4 alerts).

I’d like to only call the alert when all 4 elements are done with their fadeOut function.

This:

$cog.fadeOut('slow',function(){
})
alert('hey');

when run, will show an alert, then the $cog elements disappear (I’m guessing due to timing issues with the fadeOut animation)

Is there a way when calling a function against multiple DOM objects in a jQuery object to know when it’s done with the last item?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T00:00:27+00:00Added an answer on May 14, 2026 at 12:00 am

    You can simply count the callbacks back in.

    Try this:

    var remaining=$cog.length;
    $cog.fadeOut('slow',function(){
        if((--remaining)==0)alert('hey');
    })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sample code that shows how to create threads using MFC declares the thread function
I have posted a sample jQuery slideshow on my blog here: robertmarkbramprogrammer.blogspot.com/2010/09/jquery-slideshow.html In Chrome,
New to Javascript and jQuery, so I assume this is a pretty simple question.
I am trying to load html asynchronously using jQuery ajax function. But I for
Let's assume that we have simple jQuery code like the following: var $document =
is there simple expression to access iframe body using jquery. assume iframe's id is
I have a jQuery UI which is doing simple autocomplete function. Autocomplete is coming
Where can I find some sample projects that show jquery ajax integrated with the
This is probably a really simple jQuery question, but I couldn't answer it after
I am trying to get simple jQuery to execute on my Content page with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.