Closed steventen closed 9 years ago
Thanks, I'll check this.
This doesn't happen in current version of 2.x.
This is still happening for me in the latest 2.x. I am using a custom init() function which runs after ajax calls are made, so the inputs are iCheck'd dynamically.
This works fine (and works perfectly in 1.x), except in 2.x it creates duplicate iCheck elements.
Can you please look back into this one?
UPDATE: Something else I discovered - it seems when I run the init() function a second time, there are no duplicate checkbox elements created. But then the third and subsequent times, it creates an extra element. Not sure why...
Show me the code you use with iCheck, please.
//Checkbox
var check_target_class = "input:not(.no-touchy):not(.icheck-input)";
var check_options = {
checkboxClass: "check-it icheckbox_flat-blue",
radioClass: "check-it iradio_flat-blue"
};
//Initialise custom checkboxes
$(check_target_class).icheck(check_options);
I forgot to mention - I added the :not selector to temporarily fix the duplicate issue. But I'd like to be able to have this work natively if possible.
I also have the same problem. Extra checkboxes are created when the following code is called multiple times:
if ($('input[type="checkbox"]').length || $('input[type="radio"]').length) {
$('input[type="checkbox"].grey, input[type="radio"].grey').icheck({
checkboxClass: 'icheckbox_minimal-grey',
radioClass: 'iradio_minimal-grey',
increaseArea: '10%' // optional
});
$('input[type="checkbox"].red, input[type="radio"].red').icheck({
checkboxClass: 'icheckbox_minimal-red',
radioClass: 'iradio_minimal-red',
increaseArea: '10%' // optional
});
}
Hi,
I noticed a problem: When iCheck was initialized more than once on the same selectors, the code will generate more iCheck box, even though it was generated before.
The code I'm using looks like this (and of course if it's in v2.0, it will be icheck with lowercase):
But this does not happen on v1.0