我想在 table 中使用 RadioButtons,其中只允许选择一个
I want to use RadioButtons in a table, where only one is allowed to be selected
我有 table 个单选按钮(每行一个)。
他们将开始空缺。
一次只能点击一个。
如果我点击一个填充的单选按钮,它将清除它。
该应用程序使用 MVC、Razor、jQuery、C#。
我应该将 jQuery 与 onclick 还是 onload 一起使用?
我应该使用剃刀吗?使用 .RadioButtonFor 或 .RadioButton?
<table id='id="rdBtnID1' cellpadding="3px" class="tableBorder" style="width: 90%" >
<tr style="background: #C3C3C3">
<th align="left">Click to pick one person to Marry</th>
<th align="left">Girls Name/th>
<th align="left">Phone Number</th>
<th align="left">Email</th>
</tr>
@Html.EditorFor(m => m.Girls)
</table>
Template
@model MarriageDatabase.Models.Girls
<tr>
<td align="center" style="width:100px">
@Html.HiddenFor(m => m.GirlsID)
<div class="editor-field">
@Html.RadioButtonFor(m => m.GirlPicked, false)
</div></td>
<td style="font-weight:normal">@Html.DisplayFor(m => m.GirlsName)</td>
<td style="font-weight:normal">@Html.DisplayFor(m => m.GirlsPhone)</td>
<td style="font-weight:normal">@Html.DisplayFor(m => m.GirlsEmail)</td>
</tr>
听起来您想要更常见的单选按钮列表。只要所有收音机的输入名称都相同,您应该只能 select 一个。
试试这个:
How to get the selected value of the radio button list in jquery?
我有 table 个单选按钮(每行一个)。 他们将开始空缺。 一次只能点击一个。 如果我点击一个填充的单选按钮,它将清除它。
该应用程序使用 MVC、Razor、jQuery、C#。
我应该将 jQuery 与 onclick 还是 onload 一起使用? 我应该使用剃刀吗?使用 .RadioButtonFor 或 .RadioButton?
<table id='id="rdBtnID1' cellpadding="3px" class="tableBorder" style="width: 90%" >
<tr style="background: #C3C3C3">
<th align="left">Click to pick one person to Marry</th>
<th align="left">Girls Name/th>
<th align="left">Phone Number</th>
<th align="left">Email</th>
</tr>
@Html.EditorFor(m => m.Girls)
</table>
Template
@model MarriageDatabase.Models.Girls
<tr>
<td align="center" style="width:100px">
@Html.HiddenFor(m => m.GirlsID)
<div class="editor-field">
@Html.RadioButtonFor(m => m.GirlPicked, false)
</div></td>
<td style="font-weight:normal">@Html.DisplayFor(m => m.GirlsName)</td>
<td style="font-weight:normal">@Html.DisplayFor(m => m.GirlsPhone)</td>
<td style="font-weight:normal">@Html.DisplayFor(m => m.GirlsEmail)</td>
</tr>
听起来您想要更常见的单选按钮列表。只要所有收音机的输入名称都相同,您应该只能 select 一个。
试试这个: How to get the selected value of the radio button list in jquery?