Can I submit form with multiple submit buttons using jQuery?

jQueryWeb DevelopmentFront End Technology

Yes, you can submit form with multiple submit buttons. Attack a custom click handler to all the buttons and the check which button is clicked.


Live Demo

<!DOCTYPE html>
    <script src=""></script>
      $("#myform button").click(function (ev) {
      if ($(this).attr("value") == "button1") {            
        alert("First Button is pressed - Form will submit")
      if ($(this).attr("value") == "button2") {
        alert("Second button is pressed - Form did not submit")

<form id="myform">
  <input type="email" name="email" placeholder="Enter email" /><br>
  <button type="submit" value="button1">First Button</button>
  <button type="submit" value="button2">Second Button</button>

Updated on 20-Jun-2020 07:14:15