HTML DOM Input Selectievakje Object
Invoer selectievakje Object
Het Input Checkbox-object vertegenwoordigt een HTML <input>-element met type="checkbox".
Toegang tot een invoerselectievakje
U kunt toegang krijgen tot een <input>-element met type="checkbox" door getElementById() te gebruiken:
Voorbeeld
var x = document.getElementById("myCheck");
Tip: U kunt ook toegang krijgen tot <input type="checkbox"> door te zoeken in de elementenverzameling van een formulier.
Een invoerselectievakje maken
U kunt een <input>-element maken met type="checkbox" met behulp van de document.createElement()-methode:
Voorbeeld
var x = document.createElement("INPUT");
x.setAttribute("type", "checkbox");
Invoer Selectievakje Objecteigenschappen
Property | Description |
---|---|
autofocus | Sets or returns whether a checkbox should automatically get focus when the page loads |
checked | Sets or returns the checked state of a checkbox |
defaultChecked | Returns the default value of the checked attribute |
defaultValue | Sets or returns the default value of a checkbox |
disabled | Sets or returns whether a checkbox is disabled, or not |
form | Returns a reference to the form that contains the checkbox |
indeterminate | Sets or returns the indeterminate state of the checkbox |
name | Sets or returns the value of the name attribute of a checkbox |
required | Sets or returns whether the checkbox must be checked before submitting a form |
type | Returns which type of form element the checkbox is |
value | Sets or returns the value of the value attribute of a checkbox |
Standaard eigenschappen en evenementen
Het Input Checkbox-object ondersteunt ook de standaardeigenschappen en gebeurtenissen .
Gerelateerde pagina's
HTML-zelfstudie: HTML-formulieren
HTML-referentie: HTML <input>-tag
HTML-referentie: HTML <input> type attribuut