Objet bouton HTML DOM
Objet bouton
L'objet Button représente un élément HTML <button>.
Accéder à un objet bouton
Vous pouvez accéder à un élément <button> en utilisant getElementById() :
Exemple
var x = document.getElementById("myBtn");
Créer un objet bouton
Vous pouvez créer un élément <button> en utilisant la méthode document.createElement() :
Exemple
var x = document.createElement("BUTTON");
Propriétés de l'objet bouton
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 |
Propriétés et événements standard
L'objet Button prend également en charge les propriétés et les événements standard .
Pages connexes
Référence HTML : balise HTML <bouton>