Changing jquery ui progress bar values

I am trying to change the values โ€‹โ€‹of a progress bar widget to accept the json string that I get, something like:

{ 'totalDays' : 31, 'daysTaken' : 20 } 

so I want โ€œtotalDaysโ€ to be the total value of the progress bar (total length) and โ€œdaysTakenโ€ to populate the progress bar.

according to the default documents, you can only change the filled value:

 $(document).ready(function() { $("#progressbar").progressbar({ value: 37 }); }); 
+7
source share
2 answers

There is a separate way to set the value after init.

 var obj = {totalDays: 31, daysTaken: 20}; $("#progressbar").progressbar('value', obj.daysTaken/obj.totalDays * 100); 

There is no configurable maximum value, but it really is not necessary, as it easily normalizes values.

http://jqueryui.com/demos/progressbar/

+11
source

This is how you set the jquery-ui execution step value

 $( ".selector" ).progressbar( "option", "value", 37 ); 

Source, documentation at http://jqueryui.com/demos/progressbar/#option-value

+1
source

All Articles