Objeto de botón HTML DOM
Objeto de botón
El objeto Button representa un elemento HTML <button>.
Acceder a un objeto de botón
Puede acceder a un elemento <button> usando getElementById():
Ejemplo
var x = document.getElementById("myBtn");
Crear un objeto de botón
Puede crear un elemento <button> utilizando el método document.createElement():
Ejemplo
var x = document.createElement("BUTTON");
Propiedades del objeto de botón
Property | Description |
---|---|
autofocus | Sets or returns whether a button should automatically get focus when the page loads, or not |
disabled | Sets or returns whether a button is disabled, or not |
form | Returns a reference to the form that contains a button |
formAction | Sets or returns the value of the formaction attribute of a button |
formEnctype | Sets or returns the value of the formenctype attribute of a button |
formMethod | Sets or returns the value of the formmethod attribute of a button |
formNoValidate | Sets or returns whether the form-data should be validated or not, on submission |
formTarget | Sets or returns the value of the formtarget attribute of a button |
name | Sets or returns the value of the name attribute of a button |
type | Sets or returns the type of a button |
value | Sets or returns the value of the value attribute of a button |
Propiedades y eventos estándar
El objeto Button también admite las propiedades y eventos estándar .
páginas relacionadas
Referencia HTML: etiqueta HTML <button>