Input Color valueProperty
Examples
Modify the default color of the color picker:
document.getElementById("myColor").value = #FF8040;
Try it Yourself »
Definition and Usage
The value property sets or returns the value attribute value of the color picker.
The value property describes the default color of the color picker.
Note:The default color value is #000000 (black).
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the value property.
Note:Internet Explorer and Safari browsers do not support the <input type="color"> element.
Syntax
Return the value property:
colorObject.value
Set the value property:
colorObject.value=#hexvalue
Property Value
| Value | Description |
|---|---|
| #hexvalue | Specifies the color of the color picker. value must be a hexadecimal value (hex): 3 pairs of digits, prefixed with # (e.g.: #FF8040). Note:Color words (such as: "red" or "blue") are not allowed. Note:The default value is: #000000 (black). |
Technical Details
| Return Value: | A string, representing a color value |
|---|
More Examples
Examples
Get the color of the color picker:
var x = document.getElementById("myColor").value;
xThe output result is:#ff0080
Try it Yourself »
Related Articles
HTML Tutorial:HTML Colors
HTML Tutorial:HTML Color Values (HEX)
HTML Reference Manual:HTML <input> value Property
Input Color Object Other Extensions