[英]How to Disable the search button once it is clicked
I am in need of Disabling the search button once it is clicked. 我需要在单击后禁用搜索按钮。 This needs to be appended in the following code.
这需要附加在以下代码中。
<form class="search-head" id="frmSearch" action="<%= resultString %>" method="get">
<input name="q" class="<%=cssName%> search-tags" id="tags" value="q" maxlength=50 />
<input type="hidden" name="_charset_" value="utf-8" />
<input type="hidden" id="searchLabel" name="searchLabel" value='<%=currentStyle.get("searchLabel", "")%>' />
<c:if test="${enableSpringerSearch eq true}">
<button type="button" class="change-search-engine">${springerButtonLabel}</button>
</c:if>
<button type="submit"><fmt:message key="label_button"/></button>
Any help would be much appreciated! 任何帮助将非常感激!
You can create a separate function to handle it: 您可以创建一个单独的函数来处理它:
document.getElementById("idOfButton").onclick = function() {
//disable
this.disabled = true;
}
function disableBtn() { document.getElementById("btn").disabled = true; }
<input type="hidden" name="_charset_" value="utf-8" /> <input type="hidden" id="searchLabel" name="searchLabel" value='<%=currentStyle.get("searchLabel", "")%>' /> <c:if test="${enableSpringerSearch eq true}"> <button id="btn" type="button" onclick="disableBtn()" class="change-search-engine">search</button> </c:if> <button type="submit" ><fmt:message key="label_button"/></button>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.