我希望找到进度条的值,这样我就可以在每一步中将它增加一个百分比,但无论我尝试什么,要么说它是未定义的,要么在实例化对象之前无法调用该方法。
我尝试过的事情:
alert($('progressbar:first').prop('progress-label'));
progressbarValue = progressbar.find( ".progress-label" ).val();
HTML
<div id="progressbar"><div class="progress-label">Form Process</div></div>
if(condition == true) {
progressbar = $( "#progressbar" );
progressbarValue = progressbar.find( ".ui-progressbar-value" );
progressLabel = $( ".progress-label" );
var size = parseInt($("#fieldWrapper .step").size(),10);
var progress = 100/size ;
alert($('progressbar:first').prop('progress-label'));
progressbar.progressbar({
value: progress,
change: function() {
progressLabel.text( progressbar.progressbar( "value" ) + "%" );
},
complete: function() {
progressLabel.text( "Complete!" );
}
});
progressbarValue.css({
"background": '#' + Math.floor( Math.random() * 16777215 ).toString( 16 )
});
}