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"/>
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
});
});
请参阅API中描述的jQuery :checked
选择器。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.