ラジオボタンリストでJQueryを使用して、選択したアイテムの値を取得しようとしています。2つのラジオボタンリストがあり、最初のラジオボタンリストから問題なく価値を得ています。しかし、2番目のドロップダウンを選択すると、同じ最初のドロップダウンの結果がアラートで表示されます。
提案してください
$("#<%=RBLTechnology.ClientID%> input").change(function () {
var ProjectArchitecture = $("input[@name=RBLTechnology]:checked").val();
alert("Selected Project Architecture Layer is " + ProjectArchitecture );
});
$("#<%=RBLforService.ClientID%> input").change(function () {
var ServiceLayer = $("input[@name=RBLforService]:checked").val();
alert("Selected Service Layer is " + ServiceLayer);
});
<asp:RadioButtonList ID="RBLTechnology" runat="server" RepeatDirection="Horizontal">
<asp:ListItem Selected="True" Value="ASP.NET webforms">ASP.NET webforms</asp:ListItem>
<asp:ListItem Value="ASP.NET MVC">ASP.NET MVC</asp:ListItem>
<asp:ListItem Value="SilverLight">SilverLight</asp:ListItem>
<asp:ListItem Value="WPF">WPF</asp:ListItem>
</asp:RadioButtonList>
<asp:RadioButtonList ID="RBLforService" runat="server" RepeatDirection="Horizontal">
<asp:ListItem Selected="True" Value="Class Library Service">Class Library Service</asp:ListItem>
<asp:ListItem Value="Web Service">Web Service</asp:ListItem>
<asp:ListItem Value="WCF Service">WCF Service</asp:ListItem>
<asp:ListItem Value="WCF RIA Service">WCF RIA Service</asp:ListItem>
</asp:RadioButtonList>