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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:13:58+00:00 2026-05-28T06:13:58+00:00

How can I know which submit input is clicked on submit? For instance, I

  • 0

How can I know which submit input is clicked on submit?

For instance, I want to know whether ‘update’ submit input or ‘update_close’ submit input is clicked on submit.

html,

<form id="form_data">
    <input type="input" name="title" value="" />
    <input type="submit" name="update" value="Update" />
    <input type="submit" name="update_close" value="Update and Close"/>
</form>

jquery,

$(document).ready(function(){

        $('#form_data').submit(function(e){

            alert($(this).serialize());
            return false;
        });

    });

jsfiddle.

  • 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-28T06:13:58+00:00Added an answer on May 28, 2026 at 6:13 am

    You can’t know this in the submit handler. This information is not passed. What you could do is to subscribe to the click events of those 2 buttons and update some global variable or a HTML5 data-* attribute on the form so that inside your form submit handler you will know.

    Also if you invoke the .submit event programatically, without clicking on any button, this information simply doesn’t make sense.


    UPDATE:

    Example using HTML5 data-* attributes:

    $('#form_data :submit').click(function() {
        $(this).closest('form').data('submitbutton', $(this).attr('name'));
    });
    

    and inside your submit handler:

    $('#form_data').submit(function(e) {
        var submitButton = $(this).data('submitbutton');
        ...
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that a submit button in HTML can submit a form which opens
Suppose I have the following HTML form: <form> ... <input type=submit name=queue value=Queue item>
I want to upload an image use something like <form ...> <input type=file id=upload></input>
I have this code in my HTML form: <form action=cart.php method=post> <input type=hidden value=1
I like how this works in Zend Framework. I can know which environment I'm
How can I know which machines are alive on the same LAN as my
How can I know which stored procedure is running in SQL Server 2005. And
From code how can we know which interfaces one class implements? Example: interface IDrink
Me stupid. How can I know which assembly to reference if I just know
I get a protected memory exception, but how can I know which call caused

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.