HTML DOM Input Color autofocus Property
Example
Check if the color picker automatically gains focus on page load:
var x = document.getElementById("myColor").autofocus;
x output will be:
true
Definition and Usage
The autofocus property sets or returns whether a color picker should automatically get focus when the page loads.
This property reflects the HTML autofocus attribute.
Browser Support
The autofocus property is supported in all major browsers.
Note: Internet Explorer 9 and earlier IE versions, Opera 12 and earlier Opera versions do not support this property.
Note: Internet Explorer and Safari browsers 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 | Specifies whether the color picker should automatically get focus when the page loads.
|
Technical Details
| Return Value: | A Boolean. Returns true if the color picker automatically gets focus on page load, otherwise false. |
|---|
Related Pages
HTML Reference: HTML <input> autofocus Attribute
YouTip