2014-11-03 71 views
0

我想更改顏色選擇器值。 像這樣 $('#headcolor')。val('#e2e2e2');JS設置顏色選擇器值

headcolor是

<input id="headcolor" type="color" />

我需要幫助:(對不起我的英語

回答

0

在這裏,我已經展示了改變文本的顏色使用拾色器

<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