将百分比添加到jquery旋钮输入值 [英] Adding Percentages to jquery knob input value
本文介绍了将百分比添加到jquery旋钮输入值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用名为Jquery Knob的jQuery插件 http://anthonyterrien.com/knob/
I'm using jQuery plugin called Jquery Knob http://anthonyterrien.com/knob/
要创建循环进度条,
这是我的代码
<input type="text" value="90" class="dial" data-width="80" data-height="90" data-readOnly=true data-fgColor="#2ecc71">
JS旋钮执行
$(".dial").knob();
试图将(%)附加到value属性,但未呈现
Tried to append ( % ) to value attribute but it's not rendered
$('.dial').each(function() {
$(this).attr("value", $(this).attr("value") + "%");
});
有什么建议吗?谢谢!
推荐答案
从此插件的1.2.7版本开始,有一个format
钩子可用于更改数字的显示方式.
As of version 1.2.7 of this plugin there is a format
hook that you can use to change the way that the number is displayed.
例如,您可以指定:
$(".dial").knob({
'format' : function (value) {
return value + '%';
}
});
这篇关于将百分比添加到jquery旋钮输入值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文