A grid header contains all the Columns Names with check boxes, the last column is Re-Assign column with Check box. All the cells in the last column contains checkboxes. So, once I check the checkbox in the header all the checkboxes in that perticular column get checks. For this I used jquery with .live, its working 100% perfect. But if I want to use .On instead of .live its not working. Here I am keeping the jquery code and its libraries. Please help me in this issue. Thanks in advance.
jquery for .live: $("#<%=rgCaseRM.ClientID%> input[id*='chkHeaderRM']:checkbox").live("click", function () {
var chkHeader = $(this);
$("#<%=rgCaseRM.ClientID%> input[id*='chkReAssign']").each(function (index) {
if (chkHeader.is(":checked")) {
$("td", $(this).closest("tr")).addClass("selected");
$(this).attr('checked', true);
$("#<%=divRM.ClientID%>").show();
}
else {
$(this).attr('checked', false);
$("td", $(this).closest("tr")).removeClass("selected");
$("#<%=divRM.ClientID%>").hide();
}
});
});
$("#<%=rgCaseRM.ClientID%> input[id*='chkReAssign']:checkbox").live("click", function () { var grid = $(this).closest("table"); var chkHeader = $("#<%=rgCaseRM.ClientID%> input[id*='chkHeaderRM']:checkbox"); if (!$(this).is(":checked")) { $("td", $(this).closest("tr")).removeClass("selected"); chkHeader.removeAttr("checked"); } else { $("td", $(this).closest("tr")).addClass("selected"); if ($("[id*=chkReAssign]", grid).length == $("[id*=chkReAssign]:checked", grid).length) { chkHeader.attr("checked", "checked"); } } var checkedCheckboxes = $("#<%=rgCaseRM.ClientID%> input[id*='chkReAssign']:checkbox:checked").size();
if (checkedCheckboxes > 0) {
$("#<%=divRM.ClientID%>").show();
}
else {
$("#<%=divRM.ClientID%>").hide();
}
});