【问题标题】:JQuery Knob - number formatJQuery Knob - 数字格式
【发布时间】:2015-08-28 05:51:23
【问题描述】:

我需要格式化输入值,旋钮中心的数字。

我尝试在 .js 和 .html 文件的不同位置合并以下格式代码,但没有成功:

.toLocaleString('no-NOK');

我的 HTML:

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body { font-family:arial; }
input { color:#ffffff !important; font-size: 140% !important; }
#dial {  }
</style>
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="jquery.knob.js"></script>
</head>
<body>
<div style="overflow:hidden;margin:auto auto;width:100%;background-color:orange;position:absolute;left:0;right:0;" align="center"><input type="text" id="dial" value="2000000"></div>
<script>
    $(function() {
    $("#dial").knob({
    'fgColor':"#000000",
    'lineCap':"round",
    'min':100000,
    'max':7000000,
    'step':100000,
    'width':250,
    'height':250,
    'format': function(v) {
return "Kr. " + v ;
}

});
    });


</script>

</body>
</html>

【问题讨论】:

    标签: jquery number-formatting jquery-knob


    【解决方案1】:

    我认为你的脚本有错误。

    Try this
    
        http://codepen.io/AdelDima/pen/ueKrI
    

    【讨论】:

    • 感谢您的反馈。我的代码有效,手头的问题是值在中间呈现/格式化的方式。它说Kr。 2000000 - 我希望它显示 Kr。 2 000 000(百万和千之后的空格)。这是我的代码:link
    猜你喜欢
    • 2016-07-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多