我有几个 Jquery 进度条,我需要动态填充它们,每个都有不同的值。
HTML 代码附在下面:
<div id="Wrapper">
<form method="POST" action="ClearPoll">
<div id="mydiv" class="Gadget">
<input class="PercentageHid" type="hidden" value="36" name="Percentage">
<object class="GadgetActualImage" type="image/jpeg" data="http://upload.wikimedia.org/wikipedia/commons/a/ac/No_image_available.svg"> </object>
<div class="Information">
<input class="PollViewName" type="text" value="Potatoe Masher" placeholder="Please Enter the Gadget Name" name="Name" readonly="">
<textarea id="" class="GadgetDescription" name="Comment" cols="10" rows="4" readonly="">You'll Never Stop Mashing ! </textarea>
</div>
<div id="Potatoe Masher" class="ProgressBar ui-progressbar ui-widget ui-widget-content ui-corner-all" title="Gadget Reputation: 36.0 % " data-options="80" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="36">
<div class="ui-progressbar-value ui-widget-header ui-corner-left" style="width: 36%;"></div>
</div>
</div>
</form>
<form method="POST" action="ClearPoll">
<div id="mydiv" class="Gadget">
<input class="PercentageHid" type="hidden" value="52" name="Percentage">
<object class="GadgetActualImage" type="image/jpeg" data="http://upload.wikimedia.org/wikipedia/commons/a/ac/No_image_available.svg"> </object>
<div class="Information">
<input class="PollViewName" type="text" value="Butter Slicer" placeholder="Please Enter the Gadget Name" name="Name" readonly="">
<textarea id="" class="GadgetDescription" name="Comment" cols="10" rows="4" readonly="">No More Work </textarea>
</div>
<div id="Butter Slicer" class="ProgressBar ui-progressbar ui-widget ui-widget-content ui-corner-all" title="Gadget Reputation: 52.0 % " data-options="80" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="36">
<div class="ui-progressbar-value ui-widget-header ui-corner-left" style="width: 36%;"></div>
</div>
</div>
每个进度条应采用隐藏输入字段“百分比”中的值
我当前的 Javascript 文件如下所示:
$(document).ready(function () {
var text = $(this).find('[name="Percentage"]').val();
$(function() {
alert(text);
$('.ProgressBar').progressbar({
value: parseInt(text)
});
});
});
JavaScript 代码有效,但它将百分比值设置为所有进度条,而不是相应的。
本质上,我需要的是获取隐藏字段中的值并将该值以相同的形式应用于进度条。
谢谢你..