Input Range autofocusProperty
Example
Check whether the slider control automatically gets focus after the page loads:
var x = document.getElementById("myRange").autofocus;
xThe output result is:true
Try it Yourself »
Definition and Usage
The autofocus property is used to set or return whether the slider control automatically gets focus after the page loads.
This property reflects the HTML autofocus attribute.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the autofocus attribute
Note:Internet Explorer 9 and earlier IE versions do not support HTML <input> elements with the type="range" attribute.
Syntax
Return the autofocus property:
rangeObject.autofocus
Set the autofocus property:
rangeObject.autofocus=true|false
Property Values
| Value | Description |
|---|---|
| true|false | Describes whether the slider control gets focus after the page loads
|
Technical Details
| Return Value: | A Boolean value, returning true if the slider control automatically gets focus after the page loads, otherwise returning false. |
|---|
Related Pages
HTML Reference:HTML <input> autofocus Attribute
Input Range Object Other Extensions