Input Color autofocus attribute
Definition and usage
autofocus
Attribute setting or returning whether the color selector should automatically receive focus when the page is loaded.
This property reflects the HTML autofocus attribute.
See also:
HTML reference manual:HTML <input> autofocus egenskab
Example
Check if the color selector will automatically receive focus when the page is loaded:
var x = document.getElementById("myColor").autofocus;
Syntax
Return the autofocus attribute:
colorObject.autofocus
Set the autofocus attribute:
colorObject.autofocus = true|false
Attribute value
Value | Description |
---|---|
true|false |
Specifies whether the color selector should receive focus when the page is loaded.
|
Technical details
Return value: | Boolean value, returns if the color selector should automatically receive focus when the page is loaded true ,ellers returnerer false . |
---|
Browserunderstøttelse
Tal i tabellen viser den første browserversion, der fuldt ud understøtter egenskaben.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | 10.0 | Support | Support | Support |
Bemærk:Elementet <input type="color"> viser ingen farvevælger i Internet Explorer og Safari.