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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:48:08+00:00 2026-06-11T14:48:08+00:00

See http://jsfiddle.net/8KNc7/5/ for a working example of what I am talking about (testing in

  • 0

See http://jsfiddle.net/8KNc7/5/ for a working example of what I am talking about (testing in Firefox 15 right now, haven’t tried others).

I have a form with a submit input and a button input that both submit the form data to the server, but only the submit input causes the jQuery submit event to run. Why is this?

Form:

<form action='/echo/html/' method='post' id='Form' name='Form'>
    <input type='hidden' value='posted' id='html' name='html'>
    <input type='submit' id='submit1' value='submit type'>
    <input type='button' id='submit2' value='button type' onclick='submitForm();'>
</form>

Javascript (running at the end of the body tag):

var theForm = document.forms['Form'];
if (!theForm) {
    theForm = document.Form;
}
function submitForm() {
    theForm.submit();
}

$(function () {
    $('form').submit(function () {
        alert('ok');
    });
});

Point is, I am expecting both buttons to cause the alert but only one does. I know I can submit change the submitForm function to make it work properly but I am trying to figure out what the difference is in why one of these works and the other does not.

  • 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-11T14:48:09+00:00Added an answer on June 11, 2026 at 2:48 pm

    The native form submit method bypasses the jQuery submit handler. You can use this to your advantage in several situations.

    $("#form").submit(function(e) {
        e.preventDefault();
    
        // validation
        if (valid(this)) {
            this.submit(); // submit form, bypassing jQuery bound submit handler
        }
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm running this code in Firefox 11 on Windows 7. (See http://jsfiddle.net/QStkd/ ). $('<div><input
See http://jsfiddle.net/FDhQF/1/ for a trivial example. What's the difference between something being undefined and
Using HighCharts 2.2.3 in an ASP.NET site. See http://jsfiddle.net/wergeld/TDLvc/ for code example. My site
See http://jsfiddle.net/cgWdF/3/ Works fine in every browser*, except the latest Opera. *Haven't tested below
I want to create an arrow using CSS only Example you can see http://jsfiddle.net/b9Yfc/
See http://jsfiddle.net/e5tsL/ In chrome the button renders as it should, only in FireFox it
Please see http://jsfiddle.net/jGCx9/ I have right: 28px which causes the span element to shift
See http://jsfiddle.net/aJ333/1/ in Chrome and then in either Firefox or Internet Explorer. The image
I have the following fiddle for people to see http://jsfiddle.net/defaye/DhaHP/4/ The result on full
I've got a toggle menu, please see http://jsfiddle.net/Wp2em/41/ for code and functions. On 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.