How to read the value of selected checkbox inside a checkboxList?
- by Starx
I want to know the selected value of the markup below. So that I can disabled a textbox, if one of the checkbox is selected.
<asp:CheckBoxList ID="ChkTest" runat="server" RepeatDirection="Horizontal" CssClass="toggleYesNo">
<asp:ListItem Value="1">Yes</asp:ListItem>
<asp:ListItem Value="0">No</asp:ListItem>
</asp:CheckBoxList>
I tried using this function it doesnot seem to work
$(document).ready(function() {
$("#<%=ChkTest.ClientID %>").click(function() {
value = $(this).val();
if(value=='1') {
$('#atextbox').attr('disabled','');
}
else {
$('#atextbox').attr('disabled','disabled');
}
});
});
I also track the output HTML but the id the CheckBoxList the assigned to a table instead.