Objeto de radio de entrada HTML DOM
Objeto de radio de entrada
El objeto Input Radio representa un elemento HTML <input> con type="radio".
Acceder a un objeto de radio de entrada
Puede acceder a un elemento <input> con type="radio" usando getElementById():
Ejemplo
var x = document.getElementById("myRadio");
Sugerencia: también puede acceder a <input type="radio"> buscando en la colección de elementos de un formulario.
Crear un objeto de radio de entrada
Puede crear un elemento <input> con type="radio" utilizando el método document.createElement():
Ejemplo
var x = document.createElement("INPUT");
x.setAttribute("type", "radio");
Propiedades del objeto de radio de entrada
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 |
Propiedades y eventos estándar
El objeto Input Radio también es compatible con las propiedades y los eventos estándar .
páginas relacionadas
Tutorial de HTML: formularios HTML
Referencia HTML: etiqueta HTML <input>
Referencia HTML: atributo de tipo HTML <entrada>