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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:37:58+00:00 2026-05-30T20:37:58+00:00

Further to my problem here – jQuery on submit validation, with modal dialog at

  • 0

Further to my problem here – jQuery on submit validation, with modal dialog at the end?

It seems like the form simply will not submit using jQuery. Here’s my code at a very simplified level:

<script type="text/javascript">

     $(document).ready(function(){
        $(document).click(function() {
            $('#inputform').submit();
        });

        $("#inputform").submit(function() {
            alert('test');
            return true;
        });
    });
</script>

<form method="POST" action="<?php echo CURRENT_PAGE ?>" id="inputform">

<button type="submit" name="submit" id="submit">Submit form</button>

</form>

Clicking on the body displays the ‘test’ alert but doesn’t submit the form. Also, upon closing the alert box, it won’t re-appear when you click again.

Simply clicking on the submit button itself displays the alert then submits the form as expected.

Sorry for what is (I know) a really stupid question, but I’m at a loss here. TY!

  • 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-30T20:38:00+00:00Added an answer on May 30, 2026 at 8:38 pm

    The problem is that you’ve given your submit button the name “submit”. Change it to just about anything else and it’ll work. (Also change the id, best to keep them the same, not least because of some browser issues.)

    Why: Form elements have a property called submit which is the function you can call to submit them. (jQuery uses this under the covers when you call submit on the jQuery instance.) But Form elements also receive properties for each of the fields in the form, using the field’s name, and so if you have a field called “submit”, it overrides the submit function, which means you can’t submit the form programmatically.

    Working example: Live copy | Live source

    <script type="text/javascript">
    
         $(document).ready(function(){
            $(document).click(function() {
                $('#inputform').submit();
            });
    
            $("#inputform").submit(function() {
                alert('test');
                return true;
            });
        });
    </script>
    
    <form method="GET" action="http://jsbin.com/uwuzon" id="inputform">
    <input type="text" name="foo" value="bar">
    <button type="submit" name="someOtherName" id="someOtherName">Submit form</button>
    </form>
    

    (The significant change is the name="someOtherName" id="someOtherName" part. The other changes [changing the form’s action and method] are just so it works on JSbin.)

    Side note: You don’t have to return true; in your submit event handler to allow the form submission. You just have to not return false;. 🙂

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

Sidebar

Related Questions

Problem I would like to trace the Uri that will be generated by a
For those experienced with C, this will be a simple memory allocation/referencing problem: Here
i would like to ask for further information and suggestion about this problem. I
With reference to Problem with date day/month reversing on save I have further noted
Will there be any further resultset to process if the lookup table in the
I am working with sockets. Here are my codes (the description of problem is
All right. The problem here is pretty abstract. Bear with me. I have a
Here's a problem description. CONDITIONS: General idea is to read a lot of real
EDIT: for those who come here with a similar problem, now i know this
I'm facing some known solvable problem but struck out here. In my code, the

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.