Objeto de botão de entrada HTML DOM
Objeto de botão de entrada
O objeto Input Button representa um elemento HTML <input> com type="button".
Acessar um objeto de botão de entrada
Você pode acessar um elemento <input> com type="button" usando getElementById():
Exemplo
var x = document.getElementById("myBtn");
Dica: Você também pode acessar <input type="button"> pesquisando na coleção de elementos de um formulário.
Criar um objeto de botão de entrada
Você pode criar um elemento <input> com type="button" usando o método document.createElement():
Exemplo
var x = document.createElement("INPUT");
x.setAttribute("type", "button");
Propriedades do objeto do botão 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 |
Propriedades e eventos padrão
O objeto Input Button também suporta as propriedades e eventos padrão .
Páginas relacionadas
Tutorial HTML: Formulários HTML
Referência HTML: tag HTML <input>
Referência HTML: atributo de tipo HTML <input>