【问题标题】:change dynamicaly the attribute value to make changes in color picker动态更改属性值以更改颜色选择器
【发布时间】:2012-12-29 11:02:23
【问题描述】:

我需要动态更改属性值以更改颜色选择器:

<input id="uno" type="minicolors" name="123"   data-slider="wheel" />

这些是等价的

$("#uno").val(str[1]);
$("#uno").value(str[1]);
$('input[name="123"]').val(str[1]);
$('input[name="123"]').attr('value',str[1]);
$('input[name="123"]').attr('input',str[1]);
$('INPUT[type=minicolors]').attr('value',str[1]);

值显示在文本区域,但不会改变颜色选择器上的滑块!

我试过了,但是不行!

// $('input[name="123"]').attr('rgbObject',str[1]);  // no
// $('input[name="123"]').attr('rgbString',str[1]);  //no
// $.minicolors.rgbString(str[1]); //no

这是用于测试变量 => 完成这项工作

$('input[name=123]').css("background", str[1]); // <==background text area color for testing

我必须使用哪个属性?

谢谢

【问题讨论】:

  • 代码中的 str[1] 是什么

标签: javascript jquery html


【解决方案1】:

在这里你可以看到它是如何工作的:http://labs.abeautifulsite.net/jquery-miniColors/

你必须使用

$.minicolors.refresh()

一旦您更改了文本值以刷新颜色选择器。

【讨论】:

    猜你喜欢
    • 2020-10-13
    • 1970-01-01
    • 2019-08-13
    • 1970-01-01
    • 1970-01-01
    • 2022-10-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多