Objeto de botón de entrada HTML DOM
Objeto de botón de entrada
El objeto Botón de entrada representa un elemento HTML <input> con type="button".
Acceder a un objeto de botón de entrada
Puede acceder a un elemento <input> con type="button" usando getElementById():
Ejemplo
var x = document.getElementById("myBtn");
Sugerencia: también puede acceder a <input type="button"> buscando en la colección de elementos de un formulario.
Crear un objeto de botón de entrada
Puede crear un elemento <input> con type="button" utilizando el método document.createElement():
Ejemplo
var x = document.createElement("INPUT");
x.setAttribute("type", "button");
Propiedades del objeto del botón de entrada
Property | Description |
---|---|
autofocus | Sets or returns whether an input button should automatically get focus when the page loads |
defaultValue | Sets or returns the default value of an input button |
disabled | Sets or returns whether an input button is disabled, or not |
form | Returns a reference to the form that contains the input button |
name | Sets or returns the value of the name attribute of an input button |
type | Returns which type of form element the input button is |
value | Sets or returns the value of the value attribute of an input button |
Propiedades y eventos estándar
El objeto Botón de entrada también es compatible con las propiedades y los eventos estándar .
páginas relacionadas
Tutorial de HTML: formularios HTML
Referencia HTML: etiqueta HTML <input>
Referencia HTML: atributo de tipo HTML <entrada>