The code it works the first time. I'm trying to bold the text in a checkboxlist
"elemets", but after a postback
(submit button) the jQuery function for bold the text does not work anymore
$(document).ready(function () {
var isPostback = $("#<%=hdnIsPostback.ClientID%>").val() === "ispostback";
$("[id^=cbBold_]").css({ 'font-weight': 'bold' })
if (!isPostback)
$("#ddlPermissions").hide();
$("[id*=CbList]").click(function () {
var show = false;
$("#ddlPermissions").hide();
$("[id*=CbList] input:checked").each(function () {
show = true;
});
if (show)
$("#ddlPermissions").show();
});
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(function () {
$("[id^=cbBold_]").css({ 'font-weight': 'bold' })
});
});
CODE UPDATE:
<script>
$(document).ready(function () {
Sys.Application.add_load(function () {
var isPostback = $("#<%=hdnIsPostback.ClientID%>").val() === "ispostback";
$("[id^=cbBold_]").css({ 'font-weight': 'bold' })
if (!isPostback)
$("#ddlPermissions").hide();
$(document).on('click', '[id*=CbList]', function () {
var show = false;
$("#ddlPermissions").hide();
$("[id*=CbList] input:checked").each(function () {
show = true;
});
if (show)
$("#ddlPermissions").show();
});
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(function () {
$("[id^=cbBold_]").css({ 'font-weight': 'bold' })
});
});
});
</script>