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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:56:09+00:00 2026-05-31T19:56:09+00:00

So I have this code which is called in a print_info() function after a

  • 0

So I have this code which is called in a print_info() function after a AJAX Request;

'print_info' : function(message,type) {
        $('.load').hide();
        $('<div>'+message+'</div>').insertAfter('#loader').addClass('autoHideBox '+type).fadeIn("slow").delay(2000).fadeOut("slow", function() { $(this).remove(); });
    },

As you may see, the div fades in an out in a matter of seconds, my problem is, even if I’m adding this code :

.click(function() { $(this).fadeOut("slow", function() { $(this).remove(); }); } )

The div wont fadeOut / remove at all. Can you clear this one ? Because I’m a bit confused regarding this matter.

Regards,
Duluman Edi


Later edit:

I got it working with .on(“click”, callback), but though, fading it out and removing it in the callback just wouldn’t work.

So, in order to get it working so you can do whatever you need to do in the callback of the on(“click”, just add before .on() , stop(true,true).on(“click”,callback);

'print_info' : function(message,type) {
        $('.load').hide();
        $('<div>'+message+'</div>')
            .insertAfter('#loader')
            .addClass('autoHideBox '+type)
            .fadeIn("slow")
            .delay(2000)
            .fadeOut("slow", function() { $(this).remove(); })
            .on('click', function() {
                $(this).stop(true,true).fadeOut("slow", function() { $(this).remove(); })
            });
    },
  • 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-31T19:56:11+00:00Added an answer on May 31, 2026 at 7:56 pm

    I think the problem is that .click is only attachable to elements that were loaded originally on page load.

    Since you create the element right then, it isn’t being properly attached to the click event. Try instead using .on('click', callback) because that can be added to anything that is dynamically created after page load.

    http://api.jquery.com/on/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code which is called at an onChange event of an function
I have this code which can display drop down in div tag of html.
Let say I have this code in a JS file called plus2.js: function plus2(n){
I have this code which gets WP posts, but it gets all the posts
I have this code (which is way simplified from the real code): public interface
I have this code which compiles and works as expected: class Right {}; class
I have this code which will include template.php file from inside each of these
I have this code which should create a splash image with either no animation
I have this code which is passed to Paypal checkout: <?php foreach ($paypalBasket as
I have this code which I have found from google. It's a adapter for

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.