Input Color form Attribute

Definition and Usage

form The property returns a reference to the form that contains the color selector.

This property returns the form object on success.

Note:This property is read-only.

See Also:

HTML Reference Manual:HTML <form> 标签

Example

Get the id of the form that contains the <input type="color"> element:

var x = document.getElementById("myColor").form.id;

Try It Yourself

Syntax

colorObject.form

Technical Details

Return Value: 对包含颜色选择器的表单元素的引用。如果颜色选择器不在表单中,则返回 null

浏览器支持

表中的数字注明了首个完全支持该属性的浏览器版本。

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
支持 10.0 支持 支持 支持

注意:<input type="color"> 元素在 Internet Explorer 和 Safari 中不显示任何颜色选择器。