2019-08-28 17:08:43 2725次浏览 1条回答 0 悬赏 10 金钱
项目中引入了jquery.js和icheck.js

在初始化时:

$('.purple').iCheck({
labelHover : false, 
cursor : true, 
checkboxClass : 'icheckbox_square-purple', 
radioClass : 'iradio_polaris',
increaseArea : '20%'
});
没有问题,页面复选框都加上了相应的样式。

然后,我给一个按钮绑定事件:

$('#selecAll').on('ifChecked ifUnchecked', function(event) {
if (event.type == 'ifChecked') 
{
$(this).parent().siblings().find("input").each(function(){
    $(this).iCheck('check');
});
} 
else 
{
$(this).parent().siblings().find("input").each(function(){
    $(this).iCheck('uncheck');
});
}
});

这个时候就老是报错:$(...).iCheck is not a function

明明引入了check.js之前也没有问题啊。有知道怎么回事的吗?
  • 回答于 2019-08-29 16:14 举报

    是不是jquery引入过多或者引入位置靠后,jquery引入过多的话,可以在icheck之前添加jQuery.noConflict();,
    最后解决jqury引入问题为主

您需要登录后才可以回答。登录 | 立即注册
PHP学院的中学生
副总裁

PHP学院的中学生

注册时间:2018-10-23
最后登录:2023-07-25
在线时长:167小时55分
  • 粉丝29
  • 金钱4725
  • 威望30
  • 积分6695

热门问题