So basically I’m using jQuery ui prgoressbar and I’d like to print all the values. Here is the code:
$(function() {
var a = $('.progressbar.item1').progressbar({value: 37});
var b = $('.progressbar.item2').progressbar({value: 55});
var c = $('.progressbar.item3').progressbar({value: 99});
...
var x = $('.progressbar.itemx').progressbar({value: 29});
$(a).find('.ui-progressbar-value').append('<span>' + a.progressbar('option','value') + '%</span>');
$(b).find('.ui-progressbar-value').append('<span>' + b.progressbar('option','value') + '%</span>');
$(c).find('.ui-progressbar-value').append('<span>' + c.progressbar('option','value') + '%</span>');
...
$(x).find('.ui-progressbar-value').append('<span>' + x.progressbar('option','value') + '%</span>');
});
How can I achieve to make it shorter like using ‘for’ of ‘each’? Thanks.
Try building an object filled with the progress bars: