Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 input type color: set no color / delete color

Simple question:

(How) is it possible to set the value of an <input type="color"> to empty in the colorpicker when selecting such an input in Chrome?

Edit: I want to change the input's value to ""

like image 775
Horen Avatar asked Dec 03 '13 14:12

Horen


People also ask

How do I disable color picker?

To achieve disabled state in ColorPicker, set the disabled property to true . The ColorPicker pop-up cannot be accessed in disabled state.

How do you change the input type color in HTML?

The <input type="color"> defines a color picker. The default value is #000000 (black). The value must be in seven-character hexadecimal notation. Tip: Always add the <label> tag for best accessibility practices!

Can I make the HTML color input only display hex?

You can't make it only display hex, but whatever mode the user chooses the value is stored as hex.


1 Answers

I think it cannot be set to be transparent, but you can modify the start color with value="#colorhex".

For example;

<input type="color" value="#0000ff">

http://jsfiddle.net/j3hZB/4/

Edit: It seems that when input has type="color" there is always a color defined, and there's no way to set that string to empty.

Although here, the guy with second answer says he figured out a workaround.

like image 127
Kasperi Avatar answered Nov 16 '22 03:11

Kasperi