我想更改顏色選擇器值。 像這樣 $('#headcolor')。val('#e2e2e2');JS設置顏色選擇器值
headcolor是
<input id="headcolor" type="color" />
我需要幫助:(對不起我的英語
我想更改顏色選擇器值。 像這樣 $('#headcolor')。val('#e2e2e2');JS設置顏色選擇器值
<input id="headcolor" type="color" />
我需要幫助:(對不起我的英語
在這裏,我已經展示了改變文本的顏色使用拾色器
<html>
<body>
<input id="headcolor" type="color" onchange="func()"/>
<p id="temp">Click the button to change the value of the text field.</p>
<script>
function func() {
document.getElementById("temp").style.color = document.getElementById("headcolor").value;
}
</script>
</body>
</html>
工作JsFiddle
你可以只用JavaScript的這樣做:document.getElementById("headcolor").value="#e2e2e2";
參考:http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_color_value
希望它有幫助!