drgullin / icheck

Highly customizable checkboxes and radio buttons (jQuery & Zepto)
http://fronteed.com/iCheck
7.38k stars 1.62k forks source link

Icheckbox not working for dynamic checkboxes or radio buttons #260

Open sudheerkvn opened 9 years ago

Daijobou commented 8 years ago

I have the same problem with version 2. Add a new checkbox show fine after call icheck():

$(...).append('<input type="checkbox"......').icheck();

but now all other checkboxes are dead. Nothing happen after click on a checkbox. Only the new added checkbox will work fine.

In chrome 46 inspector I can see a endless loop in "elements".... the icheck divs get updated and updated again... and high cpu load.

This as a workaround:

// remove all traces of icheck and add it again
$('input').icheck('destroy').icheck();
Rameshwar1410 commented 6 years ago

Reassign icheck plugin when you appending checkbox. For eg see below code. $('body').on('click', '.add-new-option', function() { $('.new-option-content').append('<div class="checkbox"><label><input type="checkbox"> Sample </label></div>'); $('input').iCheck({ checkboxClass: 'icheckbox_square-blue', radioClass: 'iradio_square-blue', increaseArea: '20%' }); });