Vstupní rádiový objekt HTML DOM
Vstupní rádiový objekt
Objekt Input Radio představuje HTML prvek <input> s type="radio".
Přístup k objektu vstupního rádia
K prvku <input> můžete přistupovat s type="radio" pomocí getElementById():
Příklad
var x = document.getElementById("myRadio");
Tip: K <input type="radio"> se dostanete také prohledáváním kolekce prvků formuláře.
Vytvořte vstupní rádiový objekt
Element <input> můžete vytvořit s type="radio" pomocí metody document.createElement():
Příklad
var x = document.createElement("INPUT");
x.setAttribute("type", "radio");
Vlastnosti vstupního rádiového objektu
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 |
Standardní vlastnosti a události
Objekt Input Radio také podporuje standardní vlastnosti a události .
Související stránky
HTML výukový program: HTML formuláře
HTML reference: HTML tag <input>
HTML reference: HTML <input> typ atributu