选择颜色后尝试调用execCommand:

$('#picker').colorPicker(
    {
      defaultColor:0, // index of the default color
      columns:13,     // number of columns
      click:function(c){
             document.execCommand('ForeColor',false, c);
      }
});


但是什么也没发生。如果我用$('#output')。html(c)替换execCommand,我看到该调用成功。

例:
http://jsfiddle.net/YQQXV/12/

ColorPicker plugin page

最佳答案

我和你玩了一些小提琴,并结合了here的答案。

提琴的一个更有效的例子是here

在我看来,好像您忘记了designMode设置。

09-30 13:00
查看更多