Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Input Range autofocus Property

Input Range autofocus Property

Input Range Object Reference Input Range Object

Example

Check whether the slider control automatically gets focus after the page loads:

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

x

The output is:

true

Try it »


Definition and Usage

The autofocus property sets or returns whether the slider control automatically gets focus after the page loads.

This attribute reflects the HTML autofocus attribute.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the autofocus property

Note: Internet Explorer 9 and earlier versions do not support the HTML using the type="range" attribute .


Syntax

Return the autofocus attribute:

rangeObject

.autofocus

Set the autofocus attribute:

rangeObject

.autofocus=true|false

Attribute values

Value Description
true|false Describes whether the slider control gets focus after the page loads
  • true - The slider control gets focus
  • false - Default. The slider control does not get focus
  • |

    Technical Details

    Return Value: A Boolean value: returns true if the slider control automatically gets focus after the page loads, otherwise returns false.

    Related pages

    HTML Reference Manual: HTML autofocus attribute


    Input Range Object Reference Input Range Object