HTML5 input type color: set no color / delete colo

2020-03-15 02:08发布

问题:

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 ""

回答1:

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.