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 1036999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:47:45+00:00 2026-05-16T14:47:45+00:00

After an Ajax request, I perform the following. $(‘#change_ts’).text(‘Defaults Changed!’); //blinking part var t

  • 0

After an Ajax request, I perform the following.

$('#change_ts').text('Defaults Changed!');

//blinking part
var t = setTimeout($('#change_ts').fadeIn('slow'), 500);
clearTimeout(t);
var t = setTimeout($('#change_ts').fadeOut('slow'), 500);  
clearTimeout(t);
var t = setTimeout($('#change_ts').fadeIn('slow'), 500); 
clearTimeout(t);
var t = setTimeout($('#change_ts').fadeOut('slow'), 500);  
clearTimeout(t);  
var t = setTimeout($('#change_ts').fadeIn('slow'), 500); 
clearTimeout(t);
var t = setTimeout($('#change_ts').fadeOut('slow'), 500);  
clearTimeout(t);  
var t = setTimeout($('#change_ts').fadeIn('slow'), 500); 
clearTimeout(t);
var t = setTimeout($('#change_ts').text('Change Text/Size'), 500); 
clearTimeout(t);

It is my make-shift fade in/out blinker. It works well.

However, the first line has no effect when I perform the blinking part. If I remove the blinking the text of the span is changed. But as soon as I uncomment the blinker, it doesn’t change the text at all?!

Any ideas why this is?

Thanks all for any help

Update

The set timeout is useless for what I need to do. I have removed it now and I have the following, but I still can not change the text before the fade in/outs?

$('#change_ts').text('Defaults Changed!');

$('#change_ts').fadeIn('slow');
$('#change_ts').fadeOut('slow');
$('#change_ts').fadeIn('slow'); 
$('#change_ts').fadeOut('slow');  
$('#change_ts').fadeIn('slow'); 
$('#change_ts').fadeOut('slow');  
$('#change_ts').fadeIn('slow');

$('#change_ts').text('Change Text/Size'); 
  • 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-16T14:47:47+00:00Added an answer on May 16, 2026 at 2:47 pm

    You should pass a callback function to setTimeout, like this:

    var t = setTimeout(function() { $('#change_ts').fadeIn('slow') }, 500);
    

    Right now, you’re calling the fade function immediately and sending the return value to setTimeout. You should also change the timeout values to be increasing, like 500, 1000, 1500 etc., otherwise all the fade in/out will occur at the same time. You could use a loop to set-up the values for you. And why are you clearing the timers immediately – they won’t have any effect if you do so.

    for (var i = 1; i <= 6; i += 2) {
        setTimeout(function() { $('#change_ts').fadeIn('slow') }, 500 * i);
        setTimeout(function() { $('#change_ts').fadeOut('slow') }, 500 * (i + 1));
    }
    

    You can also make a generic blinker like this, which will keep blinking until you clear the timer:

    var state = true;
    function blink() {
      state = !state;
      if (state)
        $('#change_ts').fadeIn('slow');
      else
        $('#change_ts').fadeOut('slow');
    }
    
    var t = setInterval(blink, 500);
    

    This will keep going until you call clearInterval(t).


    Update: The reason the first text call has no effect is because the second text call is executed immediately and the text is overwritten. Note that the fadeIn and fadeOut return immediately, before the animation is completed, so the second text call executes right after that. If you want to wait until the animation is complete, you need to attach a callback to the last fade function, like this:

    $('#change_ts').fadeIn('slow', function() {
      $('#change_ts').text('Change Text/Size'); 
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following code is supposed to perform an AJAX request after the page loads,
I am using JQuery to perform form submission through an ajax request. I use
My lightview modal keeps closing after an Ajax request. Meaning when I make an
Can we specify a Javascript function to be called after the AJAX request from
I'm trying to perform an AJAX-request in a view, the user gives some input
After an ajax request, I insert a partial into the page. Now I want
I'm having trouble rebinding slimbox2 after ajax content is loaded. I realize I need
how can i disable live('click', function...) method and then after ajax call (depending on
I need certain scripts to refire after an AJAX load. How could I accomplish
I have a table which is updated with ajax and after update it if

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.