Input Color nameProperty

Input Color 对象参考手册Input Color Object

Examples

Get the name of the color picker:

var x = document.getElementById("myColor").name;
xThe result is:
favcolor

Try it Yourself »

Definition and Usage

Sets or returns the value of the name attribute of the color picker.

The name attribute is usually used as an identifier for submitting form data to the server, or as a reference identifier for JavaScript on the client side.

Note:Only when the name attribute is set can data be submitted to the server.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the name attribute.

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


Syntax

Return the name attribute:

colorObject.name

Set the name attribute:

colorObject.name=name

Property Values

Name Description
name Specifies the name of the color picker

Technical Details

Return Value: A string, representing the name of the color picker


More Examples

Example

Change the name of the color picker:

document.getElementById("myColor").name = "newColorName";

Try it Yourself »


Related Articles

HTML Reference Manual:HTML <input> name Attribute


Input Color 对象参考手册Input Color Object Other Extensions