【发布时间】:2020-09-23 02:33:09
【问题描述】:
以下是我的进度条代码。
success: function (response) {
var abc = response;
if (response != "Error!") {
$({ counter: 1 }).animate({ counter: (response + 1) },
{
step: function () {
$('.outerDiv').text(Math.ceil(this.counter) + '% Success');
$('.outerDiv').css({ 'color': 'green', 'font-size': '100%' });
$('.innerDiv').progressbar({
value: response,
})
}
})
}
else {
$('.innerDiv').each(function () { $(this).text(response); })
$('.innerDiv').css({ 'color': 'red', 'font-size': '110%', 'text-align': 'left' });
}
}
我想在各自的tds 中显示进度条。我在每一行都有buttons,并且进度条应该只显示在该行中。问题是,如果我用 id 声明 innerDiv 和 outerDiv,那么进度条只显示在一行中,因为 id 是 html 中的唯一元素。如果我为 innerDiv 和 outerDiv 声明类,那么进度条会显示在表的所有行中,这不是所需的输出。它必须只显示在一行中。我使用了innertext 和innerhtml,但它在浏览器中显示未定义innertext 的错误。请指导。
HTML 代码
<td width="350px">
<div class="innerDiv" style=" height:18px;text-align:center; width:150px; color:black">
</div>
<div class="outerDiv" style="height:18px;width:100px;">
</div>
</td>
表格html代码
@for (int i = 0; i < Model.mdl_Playlists.Count; i++)
{
<tr>
<td id="playlistid">
@Html.DisplayFor(m => m.mdl_Playlists[i].playlist_id)
</td>
<td id="playlistname">
@Html.DisplayFor(m => m.mdl_Playlists[i].playlist_name)
</td>
<td id="playlistid">
<a href="#demo11" data-toggle="collapse" class="sched"> <span class="glyphicon glyphicon-time"> </span> </a>
</td>
<td>
<button id="btnGet" class="sendbtn"><span class="glyphicon glyphicon-arrow-right"> </span> </button>
</td>
<td>
@Html.DisplayFor(m => m.mdl_Playlists[i].created_date)
</td>
<td id="state" class="progressTD" width="350px">
<div class="innerDiv" style=" height:18px;text-align:center; width:150px; color:black">
</div>
<div class="outerDiv" style="height:18px;width:100px;">
</div>
</td>
</tr>
}
</table>
【问题讨论】:
-
也许您可以在 td 上设置一个 id 并在单击按钮时将其传递,以便直接指向 id 而不是指向类
-
@Luciano 可以举个例子吗
-
好的,您可以通过添加html代码和完整的点击按钮代码来编辑问题吗?我会按照描述进行更改
-
查看答案并告诉我
标签: javascript html jquery asp.net-mvc model-view-controller