jQueryを使用してRadioButtonListの特定の要素が選択されているかどうかを確認しようとしています。以前はControl.ClientIDを使って要素のHTML IDを取得していましたが、これはリスト全体のIDを返します。私はそれがチェックされているかどうかを見ることができるように、リスト内の特定の要素のIDを取得したいと思います。RadioButtonList内の特定のラジオボタンのHTML IDを取得する方法
基本的に私が持っている:
生成<asp:RadioButtonList ID="AttendedStudySessions" runat="server">
<asp:ListItem Value="True">Yes</asp:ListItem>
<asp:ListItem Value="False">No</asp:ListItem>
</asp:RadioButtonList>
:
<tr>
<td><input type="radio" value="True" name="ctl00$ctl00$MainContent$MainContent$AttendedStudySessions" id="ctl00_ctl00_MainContent_MainContent_AttendedStudySessions_0"><label for="ctl00_ctl00_MainContent_MainContent_AttendedStudySessions_0">Yes</label></td>
</tr>
<tr>
<td><input type="radio" value="False" name="ctl00$ctl00$MainContent$MainContent$AttendedStudySessions" id="ctl00_ctl00_MainContent_MainContent_AttendedStudySessions_1"><label for="ctl00_ctl00_MainContent_MainContent_AttendedStudySessions_1">No</label></td>
</tr>
をそして、私はそれらの一つがこれに似たものを使用して選択されているかどうかを確認することができるようにしたい:
jQuery('#<%= AttendedStudySessions.Items.GetByValue("False").UniqueID %>').prop('checked');
しかし、明らかに、それは動作しません:)
を当たり前、ええ、私が考えていたものを、忘れてしまった「:チェックする」セレクタありがとう。 – Kyle