简体   繁体   中英

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

I want to disable the check box in a html table cell when other check box is checked in the same row in MVC.

The controller code is given below:

<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>

I want to disable sell when I select, buy and vice versa.. Pls help... TIA..

Consider using radio buttons instead. If you give them the same name (but different IDs) they will automatically check and uncheck each other.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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