使用Jquery有条件地禁用表行复选框
我想有条件地禁用行中的select复选框。如果文件状态为“IN”,则必须启用复选框select,否则禁用复选框select。如何使用jquery实现这一点。卡住了,需要帮助吗使用Jquery有条件地禁用表行复选框,jquery,Jquery,我想有条件地禁用行中的select复选框。如果文件状态为“IN”,则必须启用复选框select,否则禁用复选框select。如何使用jquery实现这一点。卡住了,需要帮助吗 <table id="Infiletbl" class="table table-responsive table-hover"> <tr> <th>Select</th>
<table id="Infiletbl" class="table table-responsive table-hover">
<tr>
<th>Select</th>
<th>Dept_Code</th>
<th>File_Code</th>
<th>Carton_Code</th>
<th>File_Status</th>
<th>Dept_File_ID</th>
</tr>
<tbody>
@if (ViewBag.Infilelist != null)
{
foreach (var item in ViewBag.Infilelist)
{
<tr>
<td><input id="reqflchk" name="filerequestfc" type="checkbox" class="chkCheckBoxId" value="@item.FileIN_ID" /></td>
@Html.Raw(@item.File_Status == "IN" ? "disabled" : "")
<td>@item.Dept_Code</td>
<td>@item.File_Code</td>
<td>@item.Carton_Code</td>
<td>@item.File_Status</td>
<td>@item.Dept_File_ID</td>
</tr>
}
}
</tbody>
</table>
挑选
部门代码
文件编码
纸箱编码
文件状态
部门文件ID
@if(ViewBag.Infilelist!=null)
{
foreach(ViewBag.Infilelist中的变量项)
{
@Html.Raw(@item.File_Status==“IN”?“disabled”:“)
@item.Dept\u代码
@item.File\u代码
@项目.U代码
@item.File\u状态
@item.Dept\u文件\u ID
}
}
假设这是razor,使用类型复选框将下面的内容添加到您的输入标记中
@Html.Raw(@item.File_Status==“IN”?“disabled”:“)能够使用以下代码禁用复选框
<input id="reqflchk" type="checkbox" @(item.File_Status != "Retrieval-Processed" ? " disabled='disabled'" : null) value="@item.FileIN_ID" name="filerequestfc" hidden="hidden" checked="checked" />