Latest web development tutorials

HTML DOM Input Color objects

Input Color Object

Input Color object is a new HTML5.

Input Color object represents use type = "color" attribute of the HTML <input> elements.

Note: Internet Explorer or Safari browser does not support <input> element using type = "color" property.

Input Color Access Objects

You can use getElementById () function to access using type = "color" attribute of the <input> element:

var x = document.getElementById ( "myColor" ); try

Tip: You can also form elements to access the Input Color collection of objects.

Create Input Color objects

You can use document.createElement () method to create using the type = "color" attribute of the <input> element:

var x = document.createElement ( "INPUT");
x.setAttribute ( "type", "color "); try

Input Color object properties

Attributes description
autocomplete Sets or returns the color picker's autocomplete attribute values.
autofocus Sets or returns the pick-up when the page loads whether the color gets focus.
defaultValue Sets or returns the default value of the Color Picker.
disabled Sets or returns the color picker is available.
form Return form form contains a reference to the color picker.
list Returns Color Picker datalist reference.
name Sets or returns the color picker name attribute value.
type Back Color Picker form element type.
value Sets or returns the color picker's value property values.

Standard properties and events

Input Color objects also supports standard attributes and events .


related articles

HTML Tutorial: HTML Forms

HTML Reference Manual: HTML <the INPUT> tag

HTML Reference Manual: HTML <the INPUT> of the type attribute