Getting Value of Selected Items.

Vishalneeraj-24503
Posted by Vishalneeraj-24503 under jQuery category on | Points: 40 | Views : 337
<asp:CheckBoxList ID = "CheckBoxList1" runat = "server">
</asp:CheckBoxList>
<input type = "button" value="Click" id = "btn" />

$("#btn").click(function () {
var selectedValues = [];
$("[id*=CheckBoxList1] input:checked").each(function () {
selectedValues.push($(this).val());
});
if (selectedValues.length>0) {
alert("Selected Value(s): " + selectedValues);
} else {
alert("No item has been selected.");
}
});

Comments or Responses

Login to post response