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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:36:54+00:00 2026-05-27T18:36:54+00:00

I have a form setup where a user can register, and on submittal, a

  • 0

I have a form setup where a user can register, and on submittal, a PHP script runs which validates the user, and once that is done, it echoes a messagebox which jQuery quickly hides and then fades in over the course of 1 second. What I now want to do is to be able to hide that form on submittal, and I thought this might do it:

$(document).ready(function() {
    $('div.mainsuccess,div.mainerror').hide(0).fadeIn(1000);
    $('form.register').submit(function() {
        $(this).hide(1000);
    });
});

Where div.mainsuccess is the success message, and form.register is the form (with a class of register). Now the first line works, which tells me the script is being called, but the form is not being hidden at all. I’m doing something stupid here, but I cannot figure out what?

I’ve tried to look through the jQuery API documentation for submit(), but I cannot understand what is being said. Thanks.

  • 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-27T18:36:54+00:00Added an answer on May 27, 2026 at 6:36 pm

    I think the reason it may not work is because the form is submitting it’s data and waiting for page to refresh… which means, it will stop all of it’s javascript stuff coz it’s pointless … I could be wrong but hey, your hide would take 1 second to hide but your page could reload quicker.

    $(document).ready(function() {
        $('div.mainsuccess,div.mainerror').hide(0).fadeIn(1000);
        $('form.register').submit(function(e) {
            e.preventDefault();// will stop the form being submited...
            $(this).hide(1000);
            // do ajax here...
            return false;
        });
    });
    

    Updated

    here is a list of tutorials

    http://viralpatel.net/blogs/2009/04/jquery-ajax-tutorial-example-ajax-jquery-development.html

    http://www.devirtuoso.com/2009/07/beginners-guide-to-using-ajax-with-jquery/

    http://www.sitepoint.com/ajax-jquery/

    Videos ….
    http://www.youtube.com/watch?v=0CMTQtnZ0G0

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

Sidebar

Related Questions

I have a form that the user can save and return to edit. I
I have setup a form that allows a user to make selections from drop-down
I have the following admin setup so that I can add/edit a user and
The Setup I have a (rather standard) form that allows a user to create
We have got a setup where users can either use a web-based form or
i have a form and a sortable() list where a user can drag from
I have a django form that allows a user to select multiple options: CARDS
I cannot figure out how I can setup a form that will create a
All, I have my application setup so that i can use a specific username
I have a project to setup an anonymous feedback form to our website. I

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.