Atributo de tipo HTML <botón>
Ejemplo
Dos elementos de botón que actúan como un botón de envío y un botón de reinicio (en un formulario):
<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>
Definición y uso
El type
atributo especifica el tipo de botón.
Sugerencia: especifique siempre el atributo de tipo para el
<button>
elemento. Diferentes navegadores pueden usar diferentes tipos predeterminados para el
<button>
elemento.
Compatibilidad con navegador
Attribute | |||||
---|---|---|---|---|---|
type | Yes | Yes | Yes | Yes | Yes |
Sintaxis
<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) |
❮ Etiqueta HTML <botón>