Textarea autofocusPropiedad
Ejemplo
Ver si textarea obtiene el foco automáticamente:
var x = document.getElementById("myTextarea").autofocus;
Pruébalo »
Definición y uso
El atributo autofocus se utiliza para establecer o devolver si el cuadro de texto textarea debe recibir automáticamente el foco al cargar la página.
Compatibilidad del navegador
| Propiedad | |||||
|---|---|---|---|---|---|
| autofocus | Yes | 10.0 | Yes | Yes | Yes |
Sintaxis
Devolver el atributo autofocus:
textareaObject.autofocus
Establecer el atributo autofocus:
textareaObject.autofocus = true|false
Valor de la propiedad
| Valor | Descripción |
|---|---|
| true|false |
Especifica si el cuadro de texto textarea recibe automáticamente el foco al cargar la página.
|
Detalles técnicos
| Valor de retorno: | Un valor booleano: devuelve true si se estableció el foco automático al cargar la página; de lo contrario, devuelve false. |
Otras extensiones
Objeto Textarea