HTML5 input color's default color

前端 未结 7 2112
感情败类
感情败类 2021-02-01 01:16

The input type=\"color\" has a default color which is black: #000000.

Even if I give it an empty value...

7条回答
  •  星月不相逢
    2021-02-01 01:49

    I have implemented this kind of solution for myself. It displays nice "transparent" button. When clicked it triggers the normal hidden input-color. When color is picked up, the transparent button will hide and the input-color will show up.

    Cheers.

    function clickInputColor( button )
    {
    	$( button ).next().click();
    }
    
    function inputColorClicked( input )
    {
    	$( input ).show();
    	$( input ).prev().hide();
    }
    .inputEmptyColorButton {
    	background:url("http://vickcreator.com/panel/images/transparent.png") center repeat;
    	width: 50px;
    	height: 1.5em;
    	vertical-align: bottom;
    	border: 1px solid #666;
    	border-radius: 3px;
    }
    
    
    					

提交回复
热议问题