Input Color autofocus attribute
Example
Check whether the color picker automatically gets focus when the page loads:
var x = document.getElementById("myColor").autofocus;
x
The output is:
true
Try it »
Definition and Usage
The autofocus attribute is used to set or return whether the color picker gets focus when the page loads.
This attribute reflects the HTML autofocus attribute.
Browser support





All major browsers support the autofocus attribute.
Note: Internet Explorer 9 and earlier versions, and Opera 12 and earlier versions, do not support this attribute.
**Note:** Internet Explorer and Safari browsers do not support .
Syntax
Return the autofocus attribute:
colorObject
.autofocus
Set the autofocus attribute:
colorObject
.autofocus=true|false
Attribute values
| Value | Description |
|---|---|
| true|false | Describes whether the color picker gets focus when the page loads.
|
Technical Details
| Return Value: | Boolean value, returns true if the color picker automatically gets focus when the page loads, otherwise returns false. |
|---|
Related pages
HTML Reference Manual: HTML autofocus attribute
Input Color Object