开发者

call farbtastic color picker with javascript

update

I just try to call the farbtastic color picker, all scripts are included in the Html. the following code is a form with the color picker as placeholder. How can I call my farbtastic color picker? 开发者_开发技巧I'm using the following javascript code enclosed.

enter code here <form action="controller.php" method="post" class="popupform" id="form_changecolor">

<div id="colorpicker"></div>

<table>
  <tr><th>huidige:</th><th>nieuwe:</th></tr>
  <tr><td><input type="text" name="oldcolor" disabled="disabled" id="oldcolor" />
  </td><td><input type="text" name="newcolor" id="newcolor" /></td></tr>
</table>
<div class="buttonrow">
  <input type="hidden" name="page" value="{$PAGE}" />
  <input type="hidden" name="module" value="changecolor" />
  <input type="hidden" name="id" id="parameter_key" value="" />
  <input type="submit" class="btnOk" value="Aanpassen" />
  <input type="button" class="btnCancel" value="Annuleren" />
</div>
enter code here // color picker.
$("#content").dblclick(function() {
    alert('color picker');
    $("#colorpicker").farbtastic("#color");
});


See Basic Usage on the plugin's site.


Make sure you have the empty div in place in your code. And place the jQuery script first before the farbtastic script

<form>
   <label for="color">Color:</label>
   <input id="color" type="text" value="#123456" />
   <div id="colorpicker"></div>
</form>


<script type="text/javascript">
  $(function() {
      $("#colorpicker").farbtastic("#color");
  });
</script>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜