Latest web development tutorials

HTML DOM Input Color autofocus attribute

Input Color Object Reference Input Color Object

Examples

See Color Picker whether to automatically get the focus when the page loads:

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

try it"

Definition and Usage

autofocus attribute is used to set or return to pick up the color when the page loads whether to get the focus.

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, Opera 12 and earlier version of Opera browser does not support this property.

Note: Internet Explorer and Safari browsers do not support the <input type = "color"> element.


grammar

Back autofocus properties:

colorObject .autofocus

Setting autofocus properties:

colorObject .autofocus=true|false

Property Value

描述
true|false 描述了拾色器在页面加载时是否获取焦点。
  • true - 拾色器获取焦点
  • false - 默认。拾色器不获取焦点

technical details

return value: Boolean value that, if the pick-up in color when the page loads automatically get the focus returns true, otherwise returns false.


Related Pages

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


Input Color Object Reference Input Color Object