简体   繁体   English

单击列表中的Bootstrap输入按钮禁用其他按钮

[英]Clicking Bootstrap Input Button in List Disables Other Buttons

This project uses Twitter Bootstrap, and a page lists saved files for either retrieval or deletion. 该项目使用Twitter Bootstrap,页面列出了用于检索或删除的已保存文件。 If the user clicks a "Download" input button in the list, other files' "Download" button clicks don't fire. 如果用户单击列表中的“下载”输入按钮,则不会触发其他文件的“下载”按钮单击。 How can the buttons be set up such that a user can just go down the line and download each file one after the other? 如何设置按钮,以便用户可以直接下载并逐个下载每个文件?

I've tried setting the button id to enabled or active at the end of the download script, but that hasn't worked. 我已经尝试在下载脚本结束时将按钮ID设置为启用或激活,但这没有用。 Does anyone see what's going on here? 有谁看到这里发生了什么? Thanks in advance! 提前致谢!

List in View: 列表视图:

<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>

The script for downloading a file: 下载文件的脚本:

$("#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
});

Do it by class assign as opposed to id 通过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
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Bootstrap multiselect:单击下拉列表将禁用面板上的所有输入和按钮元素 - Bootstrap multiselect: clicking on dropdown disables all input and button elements on panel 单击按钮重置引导程序输入微调器 - reset bootstrap input spinner clicking a button 引导一个按钮 select 所有其他按钮 - Bootstrap one button select all other buttons Chrome在离线时会禁用按钮和输入元素 - Chrome disables buttons and input elements when offline Bootstrap JQuery加载状态自动禁用按钮,如何使其他状态执行相同操作 - Bootstrap JQuery loading state auto disables button, how to get other states to do the same onblur禁用iOS和Mac上的点击(外部输入和点击其他输入)Safari也强制打开键盘,它不会关闭 - (Jquery) - onblur disables clicks (outside input and clicking other input) on iOS and Mac Safari also force opens the keypad and it wont close - (Jquery ) 如果其他按钮具有相同的文本,则单击单选按钮会更改其他按钮的样式 - Clicking on a radio button changes other buttons styling if they have the same text Javascript禁用Bootstrap 4中的模式弹出按钮 - Javascript disables modal popup button in bootstrap 4 jQuery-激活一个切换按钮将禁用另一个 - jQuery - Activating one toggle button disables the other 单击按钮列表中的按钮后,打开每个div - Open each div after clicking a button in a list of buttons
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM