Search code examples
phpjqueryjquery-knob

How to add a value suffix in jQuery.knob


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.

the screen shot for the issue

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)


Solution

  • 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/