且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在jQuery.knob中添加值后缀

更新时间:2023-12-01 10:05:16

尝试简单的方法,

jQuery(document).ready(function($){
        $('.ksta').knob({
            'min':0,
            'max':100,
            'step': 1,
            'displayPrevious': true,
            'readOnly': true,
            'draw' : function () { $(this.i).val(this.cv + '%'); }
        });
    });

无需更改样式和其他详细信息.....

演示: http://jsfiddle.net/renishar/DWvsh/20/

I have problem with jQuery.knob I need to add a Sufixx to the value in the knob.

For Example: i need a Sufix $ after the value, i just put in the value field, its displaying, but at that time the knob will not show the status.

it will not show the knob status. (but suffix is displaying).

here is the code:

<input type="text" class="ksta" value="<?php echo stat;?> $" data-width="50" />

without the suffix it working perfectly, help me to solve this issue.

Jsfiddle link for my issue:

http://jsfiddle.net/renishar/DWvsh/19/

in the jsfiddle it work without the $ sign, but not working with $ sign in value.

($ sign may be any value or symbol)

Try this in a simple way,

jQuery(document).ready(function($){
        $('.ksta').knob({
            'min':0,
            'max':100,
            'step': 1,
            'displayPrevious': true,
            'readOnly': true,
            'draw' : function () { $(this.i).val(this.cv + '%'); }
        });
    });

There is no need to change the styles and other details.....

Demo: http://jsfiddle.net/renishar/DWvsh/20/