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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:40:18+00:00 2026-05-24T19:40:18+00:00

Although I could find help on how to redirect pages but I could not

  • 0

Although I could find help on how to redirect pages but I could not find one which would match my situation.

I would like to fadeout the popup — which has a form inside it — before redirecting to the form’s ‘action’ link.

I have the fadeout in separate function as that function is more complicated and is called by number of times.

My jquery code :

    $('form').submit(function(e){
        function(e){
            hidePopup()
                    ,function(e){
            window.location.href = $('form').attr('action');
        };};

    });

    //hiding popup
    function hidePopup(){
        $(".popup").fadeOut("slow");
    };
  • 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-24T19:40:19+00:00Added an answer on May 24, 2026 at 7:40 pm

    fadeOut accepts a callback function as second parameter. That callback is exectued after completely feaded out. So just use:

    $(".popup").fadeOut("slow", function(){//Executes after faded out//});
    

    In your code, I’d suggest you rewrite your hidePopup function

    function hidePopup(callback){
        $(".popup").fadeOut("slow",callback);
    };
    

    And execute it like

    hidePopup(function(){
        window.location.href = $('form').attr('action');
    });
    

    Update You can check if you have passed a valid callback with the following code:

    function hidePopup(callback){
        if (typeof(callback) =='function')
            $(".popup").fadeOut("slow",callback);
        else
            $(".popup").fadeOut("slow");
    };
    

    It is a robust check that guarantees that you have passed a valid callback (well, as JS is not strictly-typed language you can’t be sure that this function have the correct signature, but that’s outside that question).

    If you are absolutely sure you will always pass callback or undefined and you are lazy enough to wish typing 20 characters less, you could simplify if (typeof(callback) =='function') to just if (callback). it will check that you have passed something. But that ‘s not a good practice (but popular though). 🙂

    Update 2: length property of a function returns the number of it’s arguments. See MDN

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

Sidebar

Related Questions

Although I read dozens of answers I could not find a solution. I'm using
i have searched for this exception everywhere but could not find a resolution &
Although this is FAQ i still couldn't find a suitable solution. I'd like to
Not sure how to work this but I found a way that works although
I got a question and although I could find related information, I'm if it
this is a known issue with ItemsControl although I couldn't find a solution :(
I couldn't find a duplicate for this question for Java, although there are a
I looked and searched and couldn't find what I needed although I think it
I'm using a jquery-ui dialog although I could switch to fancybox or colorbox, etc
I'm new to programming and especially C++ which I'm keen to learn, although out

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.