HTML button tag

HTML <button> tag defines a button labeled by its content. Various properties can be applied on the button.


<form action="files/buttontag.php" method="post">
  Name:<input type="text" name="userName"><br>
  Email:<input type="email" name="email"><br>
  <button name="submit">submit</button>

Try </>

Specific Uses

It is used to submit, save and reset the data.

Related tags

<form> form element represents the form to collect the data.
<form method="process-form.php"></form>
<input> inpu element represents the input control in the form.
<input type="radio" name="gender" value="male" />

Tag omission

Both starting and ending tags are necessary for the button element.

Global Attributes

All the global attributes are applicable on the button element.

Specific Attributes

<button> tag attributes

autofocus autofocus attribute focuses the cursor on the respective input control after the page is loaded.
<button type="submit" name="submit" autofocus>Submit</button>
disabled disabled attribute makes the button unclickable.
<button type="submit" name="submit" disabled>Submit</button>
form form attribute associates the input control to the respective form element.
<button type="submit" name="submit" form="id of form element">Submit</button>
formaction formaction attribute specifies the address (URL) to submit the form data.
<button type="button" name="button" formaction="process.php">send</button>
formenctype formenctype attribute specifies the type of encoding used for the form submission.
<button type="button" name="button" formenctype="text/html"> Send </button>
formmethod formmethod attribute specifies the HTTP method for the form submission.
<button type="button" name="button" formmethod="post"> Send </button>
formtarget formtarget attribute represents the browsing mode to submit the form.
<button type="submit" name="button" formtarget="_blank"> Send </button>
name name attribute specifies a unique name for the button.
<button type="reset" name="reset"> reset </button>
type type attribute specifies the type of button. The type may be a submit, reset and button.
<button type="reset" name="reset"> reset </button>
value value attribute labels the button element by its content.
<button type="submit" name="button" value="submit"></button>

Was this article helpful?




Get the newsletter