Input Range autofocus Attribute

Definition and Usage

autofocus The attribute sets or returns whether the slider control should automatically receive focus when the page is loaded.

This property reflects the HTML autofocus attribute.

See Also:

HTML Reference Manual:HTML <input> autofocus Attribute

Example

Determine whether the slider control should automatically receive focus when the page is loaded:

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

Try It Yourself

Syntax

Return the autofocus attribute:

rangeObject.autofocus

Set the autofocus attribute:

rangeObject.autofocus = true|false

Attribute Value

Value Description
true|false

Specifies whether the slider control should receive focus when the page is loaded.

  • true - The slider control gains focus
  • false - Default. The slider control does not gain focus

Technical Details

Return Value:

Boolean value, returned if the slider control automatically gains focus when the page is loaded true; otherwise return false.

Browser Support

The numbers in the table indicate the first browser version that fully supports this attribute.

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