Anjali
Anjali

Reputation: 73

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

Upvotes: 0

Views: 221

Answers (1)

bitfiddler
bitfiddler

Reputation: 2115

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

Upvotes: 2

Related Questions