禁用html表格单元格中的复选框,在选中同一行的其他单元格中的复选框

Disabling a checkbox in a html table cell in row on checking other check box other cell in the same row

本文关键字:复选框 单元格 其他 一行 表格 html 禁用      更新时间:2023-09-26

我想禁用复选框在html表格单元格当其他复选框被选中在MVC的同一行

控制器代码如下:

<table id='myTable1'>
<th>Buy</th>
<th>Sell</th>
<tbody>
@foreach (var item in Model)
 {
<td>
<input id="assignChkBx" name="chk" type="checkbox" value="@item.itemId">
</td>
 <td>
<input id="Buy" name="BuyPO" type="checkbox"  value="@item.itemId"/>
</td>`
}
</tbody>

</table>

我想禁用出售当我选择,购买,反之亦然。请帮助……蒂雅. .

考虑使用单选按钮。如果您给他们相同的名称(但不同的id),他们将自动选中和取消选中对方