引导程序ICheck-Helper不会在更改的事件上触发 [英] Bootstraps ICheck-Helper does not trigger on changed event
问题描述
我有此Jquery代码要根据是否已选中复选框来更新复选框.但是,这不会触发.
I have this Jquery code to be updating checkboxes base on whether a checkbox has been checked. However, This does not fire.
代码
$('body').on('change', '.territory', function () {
var PK = $(this).find('input:checkbox:first').val();
var PKStr = '.parent' + PK;
console.log('change!');
});
$('body').on('change', '.iCheck-helper', function () {
//var PK = $(this).find('input:checkbox:first').val();
//var PKStr = '.parent' + PK;
console.log('change!');
});
<div class="row">
<div class="col-md-12 col-lg-12">
<label class="control-label">
Selected Territories
</label>
</div>
@for (int c = 0; c < 2; ++c)
{
int Count = 0;
<div class="col-md-6 col-lg-6">
@foreach (var ter in Infobase.MMS.Models.ComboBoxValues.GetTerritoryRights(0))
{
if (Count % 2 == c)
{
<label>
<input type="checkbox" class="territory" value="@ter.Key">
@ter.Value
</label>
}
Count++;
}
</div>
}
</div>
我尝试绑定到iCheckbox-Helper上的click函数和change函数,以及直接绑定到复选框.但是,两者似乎都不起作用.当我不添加Icheck.js脚本时,一切工作正常.
I've tried binding to the click function and change function on iCheckbox-Helper as well as directly to the checkboxes. However neither seem to work. Everything does work fine when I dont add in the Icheck.js script.
有人知道如何从Icheckhelper类的引导中了解已更改的事件吗?
Does anybody know how to hook into on changed event from bootstraps Icheckhelper class?
推荐答案
使用文档 中提到的ifChanged或ifChecked >
Use ifChanged or ifChecked mentioned in the documentation
$('input').on('ifChecked', function(event){
alert(event.type + ' callback');
});
这篇关于引导程序ICheck-Helper不会在更改的事件上触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!