Input FileUpload autofocus attribute

Definition and Usage

autofocus Set or return whether the file upload button should automatically obtain focus when the page is loaded.

This attribute reflects the HTML autofocus attribute.

See also:

HTML Reference Manual:HTML <input> autofocus Attribute

Example

Determine whether the file upload button will automatically obtain focus when the page is loaded:

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

Try it yourself

Syntax

Return autofocus attribute:

fileuploadObject.autofocus

Set autofocus attribute:

fileuploadObject.autofocus = true|false

attribute value

value description
true|false

Specifies whether the file upload button should get focus when the page is loaded.

  • true - The file upload button gets focus
  • false - Default. The file upload button does not get focus

Technical Details

Return value: Boolean value, returned if the file upload button automatically gets focus when the page is loaded true; otherwise return false.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 10.0 Support Support Support