Textarea autofocus property
Example
Check whether the textarea automatically gets focus:
var
x
=
document
.
getElementById
(
"
myTextarea
"
)
.
autofocus
;
Try it »
Definition and Usage
The autofocus property is used to set or return whether the textarea text box should automatically get focus when the page loads.
Browser support
| property | |||||
|---|---|---|---|---|---|
| autofocus | Yes | 10.0 | Yes | Yes | Yes |
Syntax
Return the autofocus attribute:
textareaObject.autofocus
Set the autofocus attribute:
textareaObject.autofocus = true|false
Attribute values
| Value | Description |
|---|---|
| true|false |
Specifies whether the textarea text box automatically gets focus when the page loads. |
Technical Details
| Return value: | A boolean, returns true if automatic focus is set when the page loads, otherwise returns false. |
|---|
The Textarea object