jquery color picker with execCommand call
-
26-06-2021 - |
Вопрос
Trying to call execCommand after color selection:
$('#picker').colorPicker(
{
defaultColor:0, // index of the default color
columns:13, // number of columns
click:function(c){
document.execCommand('ForeColor',false, c);
}
});
but nothing happens. If i replace execCommand with $('#output').html(c) i see that call is successful.
example: http://jsfiddle.net/YQQXV/12/
Другие советы
According to MS Docs you need to pass a command ID as the first argument to execCommand. Where is your ForeColor pointing to?
$('#output').html(c)
directly changes the inner HTML of the div with ID output, that's why it works.
Не связан с StackOverflow