Latest web development tutorials

HTML DOM Input Range autofocus attribute

Input Range Object Reference Input Range Object

Examples

See if the slider control to get the focus automatically when the page is loaded:

var x = document.getElementById ( "myRange") autofocus.;
x The output is:
true

try it"

Definition and Usage

autofocus attribute is used to set or return the slider control whether to automatically get the focus when the page loads.

This property reflects the HTML autofocus property.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the autofocus attribute

Note: Internet Explorer 9 and earlier versions of IE do not support the use of type = HTML <input> element "range" attribute.


grammar

Back autofocus properties:

rangeObject .autofocus

Setting autofocus properties:

rangeObject .autofocus = true | false

Property Value

value description
true | false Describes a slider control to get the focus when the page loads if
  • true - slider control to get the focus
  • false - default. Slider control does not gain focus

technical details

return value: Boolean value that, if the page slider control to get the focus automatically after loading returns true, otherwise returns false.


Related Pages

HTML Reference Manual: HTML <the INPUT> The autofocus attribute


Input Range Object Reference Input Range Object