I’m using this plugin: https://github.com/dargullin/icheck
I’m using this in a Laravel + Vue app.
I already have included icheck and jquery in my bootstrap.js
window.$ = window.jQuery = require('jquery');
require('icheck/icheck.min.js');
I have this in my app.js:
$(document).ready(function(){
$('input:not(#nonIcheck)').iCheck({
checkboxClass: 'icheckbox_square-green',
radioClass: 'iradio_square-green',
}).on('ifChecked', function(event){
this.dispatchEvent(new Event("change"));
}).on('ifUnchecked', function(event){
this.dispatchEvent(new Event("change"));
});
});
Sometimes, it’s working, but sometimes, I noticed that the $('input:not(#nonIcheck)')
doesn’t get all the elements needed, it returns a 0 length, so I’m only getting the native checkbox/radio buttons. Is there a way to fix this?