Open In App

HTML <input type="submit">

Last Updated : 09 Dec, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

HTML <input type="submit"> is used to define a button that submits form data to the server when clicked. It is commonly used in various forms, such as email forms, contact forms, or login forms, to send the data for processing.

Note: The form handler is defined in the action attribute of the form.

Syntax

<input type="submit"> 

Attributes

AttributeDescription
valueSpecifies the text displayed on the submit button.
nameDefines a name for the submit button, useful for identifying the button in the form data.
disabledDisables the submit button, preventing the form from being submitted.
formSpecifies the form that the submit button belongs to when not inside a form tag.
formactionDefines the URL where the form data will be sent for processing when the button is clicked.
formenctypeSpecifies how the form data should be encoded when submitting it to the server.
formmethodSpecifies the HTTP method (GET or POST) to use when sending form data.
formtargetSpecifies where to display the response after submitting the form (e.g., in a new window).
autofocusAutomatically focuses the submit button when the page loads.
formnovalidatePrevents form validation when submitting the form using this submit button.

Example: We are using the HTML <input type="submit"> to create a submit button for a form. When clicked, it submits the form data (username and password) to the server for processing.

html
<!DOCTYPE html>
<html>

<body style="text-align:center;">
    <h2>HTML &lt;input type="submit"&gt;</h2>

    <form action="#">
        <label for="uname">User Name:</label>
        <input type="text" id="uname">
        <br><br>

        <label for="pwd">Password:</label>
        <input type="password" id="pwd">
        <br><br>

        <input type="submit" value="Submit">
    </form>
</body>

</html>

Output

HTML-Input-Type-Submit example

Supported Browsers


Next Article

Similar Reads