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