Click here to Skip to main content
15,891,981 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
want to change the text of JQuery Knob. For example I have a rate 23% consumed I want to put 23% on row and consumed in new row inside the circle. In other word, I want to add (consumed) under the percentage in different style (The font size of rate 16px and consumed 12px)
Posted
Comments
Deepu S Nair 10-Mar-15 9:24am    
What you tried?
muhanad muneer 10-Mar-15 9:31am    
I have jquery plugin which is draw circular progress bar
http://anthonyterrien.com/knob/ . I want to add the percentage inside the circular progress in addition to text under the percentage.for example i have $100 in credit i consumed $10 it must be print 10% consumed 10% on row and consumed in other. H ow I can edit on the knob jquery plugin to accept this changes.
Sergey Alexandrovich Kryukov 10-Mar-15 15:29pm    
What's the problem with reading the knob documentation?
—SA

1 solution

Here is what I've done: I loaded the page you've referenced, and, seeing no documentation, clicked "View" -> "Page source" (these menu items may vary) looked at the page source and found samples like
HTML
<input class="knob" data-width="200" data-min="-100" data-displayPrevious=true value="44">


(Bad sample to be sure: all attribute values should better be in quotation marks.)
As you can see you can just change the value attribute value. Let's say, you use jQuery to get a wrapper to this elements by id:
HTML
<input id="myKnob" class="knob" data-width="200" data-min="-100" data-displayPrevious=true value="44">

In JavaScipt:
JavaScript
var myKnob = $("#myKnob"); // using id selector
// ...
myKnob.val(55);

Try it out. The value 44 should change to 55. And so on…

Please see:
http://api.jquery.com/id-selector[^],
http://api.jquery.com/category/selectors[^],
http://api.jquery.com/val[^].

—SA
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900