Atributo de tipo HTML <button>
Exemplo
Dois elementos de botão que atuam como um botão de envio e um botão de redefinição (em um formulário):
<form action="/action_page.php" method="get">
<label for="fname">First name:</label>
<input type="text" id="fname"
name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br><br>
<button type="submit" value="Submit">Submit</button>
<button type="reset" value="Reset">Reset</button>
</form>
Definição e uso
O type
atributo especifica o tipo de botão.
Dica: Sempre especifique o atributo type para o
<button>
elemento. Diferentes navegadores podem usar diferentes tipos padrão para o
<button>
elemento.
Suporte ao navegador
Attribute | |||||
---|---|---|---|---|---|
type | Yes | Yes | Yes | Yes | Yes |
Sintaxe
<button type="button|submit|reset">
Valores de atributo
Value | Description |
---|---|
button | The button is a clickable button |
submit | The button is a submit button (submits form-data) |
reset | The button is a reset button (resets the form-data to its initial values) |
❮ Tag HTML <button>