有 2 个 RadioButtonLists:
Are you a minor?: oYes oNo
Do you wish a joint account?: oYes oNo
如果第一个问题的答案是肯定的,我想检测对第一个问题的回答并使用 jQuery 函数将第二个问题的答案设置为是。提前致谢。
<asp:Label ID="lblMinfor" CssClass="boldIt" runat="server" Text="Is this account for a minor" Style="float: left; width: 200px;"></asp:Label><br />
<asp:RadioButtonList ID="rdlMinor" runat="server" RepeatDirection="Horizontal" Width="130px" Style="float: left;" BorderStyle="None" RepeatLayout="Flow" ()>
<asp:ListItem>Yes</asp:ListItem>
<asp:ListItem Selected="True">No</asp:ListItem>
</asp:RadioButtonList>
<asp:Label ID="lblJoint" CssClass="boldIt" runat="server" Text="Is this for a joint account?" Style="float: left; width: 200px;"></asp:Label><br />
<asp:RadioButtonList ID="rdlJoint" runat="server" RepeatDirection="Horizontal" Width="130px" Style="float: left;" BorderStyle="None" RepeatLayout="Flow">
<asp:ListItem>Yes</asp:ListItem>
<asp:ListItem Selected="True">No</asp:ListItem>
</asp:RadioButtonList>
最佳答案
$('#<%=rdlMinor.ClientID %>').change(function() {
if($('#<%=rdlMinor.ClientID %> input:checked').val() == 'Yes')
{
$('#<%=rdlJoint.ClientID %>').find("input[value='Yes']").attr("checked", "checked");
}
});
关于c# - ASP.Net 单选按钮列表 : using jQuery to get the ListItem selected,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9403451/