Reputation: 201
How to get the selected items values of checkBoxList in button click event in jquery...
<asp:CheckBoxList ID="check_list" runat="server">
<asp:ListItem Text ="One" Value="1"></asp:ListItem>
<asp:ListItem Text ="Two" Value="2"></asp:ListItem>
<asp:ListItem Text ="Three" Value="3"></asp:ListItem>
</asp:CheckBoxList>
<input type="button" id="btn_click" value="Click"/>
Upvotes: 0
Views: 2116
Reputation: 8892
just use an attribute selector like On click of button you can loop trough all checked values like
$("#btn_click").click(function(){
$("[id*=check_list] input[type=checkbox]:checked").each(function () {
// add $(this).val() to your array
});
});
Upvotes: 1