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

  • SEARCH
  • Home
  • 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 6023215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:58:18+00:00 2026-05-23T03:58:18+00:00

I have a strange need. I would like to do the following in javascript:

  • 0

I have a strange need. I would like to do the following in javascript:

  1. when a function is called I want
    to change the color of a DIV and
    then 1/2 second later I would like
    to change it back
  2. at the same time as (1) I would
    like to make an Ajax call. The call
    typically takes one second

In other words I would like step 1 and step 2 to start at the same time.

My knowledge of javascript is pretty basic. Is this kind of thing possible? How about if I use jQuery, would that make it easier?

  • 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-23T03:58:19+00:00Added an answer on May 23, 2026 at 3:58 am

    You can use jQuery and its function queue, to delay an action.

    I forked wdm’s version on jsFiddle, to change it to queue style, instead of setTimeout. In my own belief, this is a much cleaner and better way to achieve what you are looking for.

    Here is the forked Demo

    Here is the JavaScript code:

    $('#change').click(function(e) {
        e.preventDefault();
    
        $('#a')
            .css('background-color', 'blue')
            .delay(500)
            .queue(function(next){
                $(this).css('background-color', 'red');
                next();
            });
    
        $.ajax({}); // do the ajax call here
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a strange application in that for development and testing I need a
Friends, I have a strange need and cannot think my way through the problem.
I have a basic question regarding timers. My timer is acting very strange. I
We have a Team City Build Server running and want to compile a Visual
I have strange problem with sharepoint and ajax functionality. We have an UpdatePanel placed
Any help with building the following design around a .NET app would be appreciated.
I have been given an XML document in a rather strange format and I
What I'm asking may sound strange, but I really need it.. What I need
I have a query that joins two tables. One table has a column that
I have a webservice method that reads a photo and returns its byte data.

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.