Search code examples
jquerytwitter-bootstrapadminlte

AdminLTE with checkbox on change handling not working


I used the iCheck class for my checkbox :

<head>
...
<spring:url value="/resources/js/plugins/iCheck/all.css" var="iCheckCss" />
        <link rel="stylesheet" href="${iCheckCss}">
...
<spring:url value="/resources/js/plugins/iCheck/icheck.min.js" var="iCheckJs" />
        <script src="${iCheckJs}"></script>
...
</head>
<body>
...
<label><span id="select_all_${groupe_menu.gmnu_code}"></span> <input type="checkbox" class="minimal" id="selectToutC_${groupe_menu.gmnu_code}" /></label>
...
</body>
<script type="text/javascript">

    $(function() {

        $("span[id^='select_all_']").each(function(){
            $(this).html(_getText("admin.choix.select.deselect.tout"));
        });

        //iCheck for checkbox and radio inputs
        $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
            checkboxClass: 'icheckbox_minimal-blue',
            radioClass: 'iradio_minimal-blue'
        });

        $(":checkbox[id^='selectToutC_']").on("change", function(e) {
             alert("ddddd");
        });

    });

</script>

At runtime when I click the checkbox then the alert does not show ! So what is wrong ?


Solution

  • This is all available callbacks of iCheck: Callbacks

    you can use ifChanged event instead