Input Color autofocusProperty
Examples
Check if the color picker automatically gets focus when the page loads:
var x = document.getElementById("myColor").autofocus;
xOutput:true
Try it Yourself »
Definition and Usage
The autofocus property is used to set or return whether the color picker gets focus when the page loads.
This property reflects the HTML autofocus attribute.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the autofocus property.
Note:Internet Explorer 9 and earlier versions, and Opera 12 and earlier versions, do not support this property.
Note:Internet Explorer and Safari do not support the <input type="color"> element.
Syntax
Return the autofocus property:
colorObject.autofocus
Set the autofocus property:
colorObject.autofocus=true|false
Property Values
| Value | Description |
|---|---|
| true|false | Describes whether the color picker gets focus when the page loads.
|
Technical Details
| Return Value: | A Boolean, returns true if the color picker automatically gets focus when the page loads, otherwise returns false. |
|---|
Related Pages
HTML Reference:HTML <input> autofocus Attribute
Input Color Object Other Extensions