单击列表中的引导输入按钮将禁用其他按钮
Clicking Bootstrap Input Button in List Disables Other Buttons
这个项目使用Twitter Bootstrap,一个页面列出了保存的文件以供检索或删除。 如果用户单击列表中的"下载"输入按钮,则不会触发其他文件的"下载"按钮单击。 如何设置按钮,以便用户可以下线并一个接一个地下载每个文件?
我尝试在下载脚本结束时将按钮 ID 设置为启用或活动,但这不起作用。 有人看到这里发生了什么吗? 提前感谢!
视图中的列表:
<div class="panel panel-default" id="uploadPanel">
<div class="panel-heading">Uploaded Files</div>
<div class="panel-body">
<table id="dt_basic" class="table table-striped">
<thead>
<tr>
<th style="display:none"></th>
<th class="text-center">File Name</th>
<th class="text-center">Uploaded Date</th>
<th class="text-center">Uploaded By</th>
<th></th>
</tr>
</thead>
<tbody>
@if (Model.UploadedFiles.Any())
{
foreach (var record in Model.UploadedFiles)
{
<tr>
<td style="display:none">@record.UploadedFileID</td>
<td align="center">@record.UploadedFileName</td>
<td align="center">@String.Format("{0:d}", @record.UploadedFileDate)</td>
<td align="center">@record.UploadedBy</td>
<td align="center"><input type="button" class="btn btn-info" id="downloadFile" value="Download"> | <input type="button" class="btn btn-warning" id="deleteFile" value="Delete"></td>
</tr>
}
}
</tbody>
</table>
</div>
</div>
下载文件的脚本:
$("#downloadFile").click(function () {
var cells = $(this).closest('tr').children('td');
var $id = Number(cells.eq(0).text());
var $url = '@Url.Action("DownloadFile", "Files", new { id = "_id_" })';
document.location.href = $url.replace("_id_", $id);
//Tried re-activating and re-enabling $("downloadFile") here, but to no avail
});
通过class
分配而不是id
来执行此操作
<td align="center"><input type="button" class="btn btn-info downloadFile" value="Download"> | <input type="button" class="btn btn-warning deleteFile" value="Delete"></td>
$(".downloadFile").click(function () {
var cells = $(this).closest('tr').children('td');
var $id = Number(cells.eq(0).text());
var $url = '@Url.Action("DownloadFile", "Files", new { id = "_id_" })';
document.location.href = $url.replace("_id_", $id);
//Tried re-activating and re-enabling $("downloadFile") here, but to no avail
});
相关文章:
- 剑道UI内联编辑:如何在点击其他按钮时隐藏按钮
- jQuery:暂停按钮可以暂停所有其他操作
- 重定向到“提交”按钮上的其他控制器
- 影响其他按钮的点击删除
- 为什么只有最新的按钮才能工作?我发现其他按钮的点击函数为空
- HTML 按钮以在页面上的其他位置提交表单
- 单击列表中的引导输入按钮将禁用其他按钮
- 选择其中一个单选按钮,然后单击“提交”,重定向其他页面
- 我用脚本创建了一个按钮.我可以通过点击按钮调用其他函数吗?我这样做,但失败了
- 如何使用“引导”来选择引导选项卡;下一个“;按钮我遵循了其他答案,但没有奏效
- 如何使用可点击按钮在Datepicker日历中选择用户在其他月份的当前日期
- 如果用户单击其他按钮,则禁用表单元素
- 使用提交按钮提交表单,而不是页面上的其他按钮
- Javascript错误,根据其他复选框的结果更新复选框/按钮
- 按钮(禁用=错误)条件;在某些情况下有效,而在其他情况下无效
- 如何在不影响其他按钮的情况下更改按钮
- 在Firefox和IE中,向按钮添加填充可以向下推其他按钮
- 我开发了一个api,我希望它重定向到其他php页面,并在我点击api文件中的按钮时弹出模态
- 简单模态弹出窗口 - 使用其他按钮关闭弹出窗口
- 数据表删除按钮在其他页面上不起作用,除了第一个