我将iCheck
类用于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>
在运行时,当我单击复选框时,警报不会显示!那有什么不对?
答案 0 :(得分:2)
这是iCheck的所有可用回调:Callbacks
您可以使用ifChanged
事件
答案 1 :(得分:1)
您可以将ifChanged事件用于icheck
//copy address from correspondence address to permanent address
$('#same_address').on('ifChanged', function(event){
if(this.checked) // if changed state is "CHECKED"
{
var correspondence_address = $('#correspondence_address').val();
$('#permanent_address').val(correspondence_address);
}
else
{
$('#permanent_address').val('');
}
});