Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Input Color name attribute

Input Color name attribute

Input Color Object Reference Input Color Object

Example

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 name attribute value of the color picker.

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

Note: Only by setting the name attribute 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 .


Syntax

Return the name attribute:

colorObject

.name

Set the name attribute:

colorObject

.name=

name

Attribute values

Name Description
name Specify the name of the color picker

Technical Details

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

More examples

Example

Modify the name of the color picker:

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

Try it »


Related Articles

HTML Reference Manual: HTML name attribute


Input Color Object Reference Input Color Object