简体   繁体   English

按下删除按钮后如何禁用它?

[英]How to disable a delete button after it has been pressed?

I have small table which has the following code for the delete button.我有一个小表,其中包含以下删除按钮的代码。 When I click on the delete button all the delete buttons in the row are disabled.当我单击删除按钮时,该行中的所有删除按钮都被禁用。 I only want one button to be disabled corresponding to the appropriate value in the table.我只希望禁用与表中相应值对应的一个按钮。 The rest of the buttons should stay enabled.其余按钮应保持启用状态。

                <c:when
                    test="${(****) == 1 && ****}">
                    <display:column title="Delete" class="cell-text-centered">
                        <i class="btn-link glyphicon glyphicon-trash"
                            onclick="fn_delete('<%=urlDelete%>')"></i>
                    </display:column>
                </c:when>
                <c:otherwise>
                    <display:column title="Delete" style="width:5%"
                        class="cell-text-centered">
                        <i class="glyphicon glyphicon-trash"></i>
                    </display:column>
                </c:otherwise>
            </c:choose>

<script>
function fn_delete(url) {
    var deleteAnswer = confirm("Do you want to delete corresponding data?");
    if (deleteAnswer == true) {
        document.Form.action = url;
        document.Form.submit();
    }
}
</script>

When you click on the button , you might get an event e available inside function scope.当您单击按钮时,您可能会在函数范围内获得一个可用的事件 e。 See if you could use the source of an event and add add an attribute called disabled to your html button element看看您是否可以使用事件源并添加一个名为 disabled 的属性到您的 html 按钮元素

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM