<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type = "text/javascript">
$("#demo").live("click", function () {
var selectedItems = "";
$("[id*=chkFruits] input:checked").each(function () {
if (selectedItems == "") {
selectedItems = "Selected Items:\r\n\r\n";
}
selectedItems += $(this).next().html() + "\r\n";
});
if (selectedItems != "") {
alert(selectedItems);
} else {
alert("No item has been selected.");
}
});
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:CheckBoxList ID="chkFruits" runat="server">
<asp:ListItem Text="Mango" Value="1"></asp:ListItem>
<asp:ListItem Text="Apple" Value="2"></asp:ListItem>
<asp:ListItem Text="Banana" Value="3"></asp:ListItem>
<asp:ListItem Text="Pineapple" Value="4"></asp:ListItem>
<asp:ListItem Text="Orange" Value="5"></asp:ListItem>
</asp:CheckBoxList>
<input type = "button" id = "demo" value = "Demo" />
</form>
</body>
</html>