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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:00:20+00:00 2026-06-02T16:00:20+00:00

I have an interactive form system that has different modules, where the forms for

  • 0

I have an interactive form system that has different modules, where the forms for each module is contained inside a different div element. When i change from one module to another, I often do this:

$('#module_1').hide();
$('#module_2').fadeIn();

I like this, but now, after developing this system for some time, I have some functions (like re-initialize a jqgrid) that I want to happen every time a fadeIn occurs. I set up this up like this:

$('#module_2').bind('fadeIn',function(){
    initialize_jqgrid();
});

Is there a way I can make this work for all instances of $('#module_2').fadeIn(); without having to go to every instance and replace it with this?

$('#module_2').fadeIn().trigger('fadeIn');

The motivation behind this is just to have cleaner code, $('#module_2').fadeIn().trigger('fadeIn'); is a little redundant.

Thanks a lot!

  • 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-06-02T16:00:23+00:00Added an answer on June 2, 2026 at 4:00 pm

    Sure,

    var _old = $.fn.fadeIn;
    
    $.fn.fadeIn = function(){
        var self = this;
        return _old.apply(this,arguments).promise().done(function(){
            self.trigger("fadeIn");
        });
    };
    
    // and your code: // replace .bind with .on if jQuery 1.7+
    ​$("div").bind("fadeIn",function(){alert("worky");});
    
    $("div").fadeIn(2000);​​​​​​​​​​​​​​​​​
    

    Demo
    http://jsfiddle.net/gEVsX/2/

    Update for comment

    var _old = $.fn.fadeIn;
    
    $.fn.fadeIn = function(){
        return _old.apply(this,arguments).trigger("fadeIn");
    };
    
    // and your code: // replace .bind with .on if jQuery 1.7+
    ​$("div").bind("fadeIn",function(){alert("worky");});
    
    $("div").fadeIn(2000);​​​​​​​​​​​​​​​​​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a window form application, and it has multiple threads running that would
I have a custom UIView that contains an interactive drawing that is drawn in
I'm writing an interactive function that I'd like to have remember the last argument
we're have a client that needs to get interactive messages from a server, from
I have an projector file/Flash application that I need to turn into an interactive
So I have the following VB.NET code that creates a form field in a
I have a WPF application that hosts a modeless Win32 form. Everything runs smoothly,
I have a completely non-interactive python program that takes some command-line options and input
I have a keyboard focus problem with Windows Forms application that hosts WPF UserControls.
I have a form that I want to close after 5 seconds if no

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.