Color Picker / Posts /

load the color in color picker on the basis of div current background

1.How to show/load the color in color picker on the basis of current div background(i.e) vice versa of current process?
2.How to change the default color from white to some another colors?
velan  11 years ago   viewed: 11549    

1 Answer

1. It is better to give each input a value of your DIV color: <input type="text" id="cinput2" class="color" value="#333333" />
Otherwise, you can try the following script(need to be placed at the end of your page HTML code, just before the </body> tag):
<script> var myDivBgColor="#333333"; var inputs = document.getElementsByTagName("input"); for(var i=0; i<inputs.length; i++){ if(inputs[i].className == "color") inputs[i].value=myDivBgColor; } MC.ColorPicker.reload(); </script>
2. If you do not take the above solution, and still want a specific default color, you can open the mcColorPicker.js (versioned v2012.8.30), search for the code below:
and update it as:
{if(a.value==""){"red";return;} try{}catch(c){}}
Joe   11 years ago


Your name*
(Optional. Used to modify this post afterwords)
+ =  

Ask your Own Question

  • If your question is related to the topic of this post, you can post your question to this page by clicking the "Post a reply" button at left;

  • When you want to start a new page for your question: