Радиообъект ввода HTML DOM
Входной радиообъект
Объект Input Radio представляет собой HTML-элемент <input> с type="radio".
Доступ к входному радиообъекту
Вы можете получить доступ к элементу <input> с type="radio" с помощью getElementById():
Пример
var x = document.getElementById("myRadio");
Совет: Вы также можете получить доступ к <input type="radio">, выполнив поиск в коллекции элементов формы.
Создайте входной радиообъект
Вы можете создать элемент <input> с type="radio" с помощью метода document.createElement():
Пример
var x = document.createElement("INPUT");
x.setAttribute("type", "radio");
Введите свойства радиообъекта
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 |
Стандартные свойства и события
Объект Input Radio также поддерживает стандартные свойства и события .
Связанные страницы
Учебник по HTML: HTML-формы
Справочник по HTML: HTML-тег <input>
Справочник по HTML: HTML-атрибут типа <input>