In this section, we will learn what the <input type = “submit”> element is and how to use it.
Submit Button in HTML: What is input type submit in HTML?
We use HTML <input type = “submit”> element to create a button that is used in forms to submit those form data to a server.
Basically, in webpages that have forms with the submit button, that button most likely is created with the input element of type submit.
We usually put an input element of type submit within the body of a form element. This way the button becomes attached to the target form and if we click it, it will send the data of that form to a server.
Note that we’re not limited to just putting the submit button in the body of target <form> element! In fact, we can put this button anywhere in a document and still be able to connect it to a form! To do this, we use an attribute called `form` for elements of type submit!
The value we set for this `form` attribute is the value of the target form’s id attribute.
HTML input type submit Syntax:
<input type = ”submit”>
HTML input type submit Values
For input elements of type submit, we also use the value attribute to set the text content on that button.
Example: submit form in HTML
See the Pen submit form in HTML by Omid Dehghan (@odehghan) on CodePen.