Form with multiple submit buttons
A form can have multiple
<button type=submit>) elements. You can specify different values, targets, methods or even different actions for these.
Recently, I’ve been exploring the html
The example above has two sections:
- Form with two submit buttons with the same
nameattribute, but different values. By default, hitting one of the two submits will submit the form and change the URL of the example website, depending on the value of the clicked element. Kinda like a radio group, but for distinct actions a user can take.
- The same form, but this time intercepting the forms
There are more things you can specify on a submit element, like the
action to submit to or the forms
method. See this MDN page on the input[type=submit] element.