[英]jquery button enable and disable based on data retrieved from DB
i have a button with drop down list, i want the button to be enabled only for one cert type. 我有一个带有下拉列表的按钮,我希望仅对一种证书类型启用该按钮。 I am getting the cert type from DB and using below code. 我从数据库获取证书类型,并使用以下代码。 The button i want to enable and disable is the "Action" button. 我要启用和禁用的按钮是“操作”按钮。 I have the cert type fetched and listed in the table as (${cert.certType}). 我获取并在表中以($ {cert.certType})形式列出了证书类型。 How could i used that field to enable and disable the function. 我如何使用该字段启用和禁用该功能。 Could anyone help? 有人可以帮忙吗? Thanks. 谢谢。
code Snippet: 代码段:
<c:forEach var="cert" items="${certificates}" varStatus="status">
<tr>
<td><c:out value="${status.count}" /></td>
<td>${cert.commonName}</td>
<td>${cert.validFrom}</td>
<td>${cert.validTo}</td>
<td>${cert.generatedDate}</td>
<td>${cert.certType}</td>
<td></td>
<td></td>
<td>
<div class="btn-group">
<button type="button"
class="btn btn-default dropdown-toggle ${cert.certType}"
data-toggle="dropdown">
Actions <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a data-toggle="modal"
data-target="#editCertModal" data-id="${cert.id}">Edit Cert</a></li>
<li><a data-toggle="modal"
data-target="#deleteCertModal_${cert.id}">Delete Cert</a></li>
<li><a data-toggle="modal"
data-target="#renewCertModal" id="${cert.id}">Renew Cert</a></li>
<li><a title="Downloads the cert in .pem file"
href="/DownloadPemFile/${cert.id}">Download</a></li>
<li><a
onclick="alert('To be implemented.');">View EventLog</a></li>
</ul>
</div>
</td>
</tr>
</c:forEach>
In JS file i used below:- 在JS文件中,我使用以下:
$(function(){ $('.IssuerCert').prop('disabled', true); }); $(function(){$('。IssuerCert')。prop('disabled',true);});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.