Latest web development tutorials

HTML DOM Input Color name attribute

Input Color Object Reference Input Color Object

Examples

Get the name of the color picker:

var x = document.getElementById("myColor").name;
x The output is:
favcolor

try it"

Definition and Usage

Sets or returns the color picker name attribute value.

name attribute is typically used to server identifiers submitted form data, or the client as a Javascript reference identification.

Note: Only the name attribute is set to submit data to the server.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support name attribute.

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


grammar

Returns the name attribute:

colorObject .name

Setting name attribute:

colorObject .name= name

Property Value

名称 描述
name 指定拾色器的名称

technical details

return value: String representing the name of the color picker


More examples

Examples

Modify the name of the color picker:

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

try it"


related articles

HTML Reference Manual: HTML <the INPUT> name attribute


Input Color Object Reference Input Color Object