I have some Javascript that works perfectly before a postback happens in ASP.Net, however when a postback event occurs from a button click the script no longer runs.
this is the code I am using
function displayCheckboxInSubject() {
var CountSelectedCB = [];
console.log("in displayCheckBoxInSubject with loader");
$(".subjectCB").on("change loader", function () {
//$(".subjectCB").change(function () {
selectedCB = [];
notSelectedCB = [];
CountSelectedCB.length = 0;
$(".subjectCB").each(function () {
//alert("in here two")
if ($(this).find("input").is(":checked")) {
//alert("in here three")
CountSelectedCB.push($(this).find("input").val());
}
});
$("#txtSubject").val(CountSelectedCB.join(", "));
}).trigger("loader");
}
$(document).ready(displayCheckboxInSubject);
I would be grateful if someone could point me in the right direction of how to resolve this.
thanks
Simon