Textarea autofocusProperty

Textarea 对象参考手册Textarea Object


Examples

Check whether the textarea automatically gets focus:

var x = document.getElementById("myTextarea").autofocus;

Try it Yourself »

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 property:

textareaObject.autofocus

Set the autofocus property:

textareaObject.autofocus = true|false


Property Values

Value Description
true|false

Specifies whether the textarea text box automatically gets focus when the page loads.

  • true - The textarea element automatically gets focus.
  • false - Default. The textarea element does not get focus.


Technical Details

Return Value: A Boolean value, returns true if autofocus is set when the page loads, otherwise false.


Textarea 对象参考手册Textarea Object

Other Extensions