javascript - jQuery icheck plugin not working after being append -
i have add together button , when click append following:
<div class="checkbox"> <label> <input type="checkbox"> sample </label> </div> to div (class name .new-option-content). fiddle
i using jquery icheck plugin stylize check boxes. when append don't see icheck styling on check boxes. why can happen ? phone call function why it's not showing it's styling after append ?
any help appreciated.thanks
jquery
// radio , checkboxes $('input').icheck({ checkboxclass: 'checkbox-default', radioclass: 'radio-default' }); $('body').on('click', '.add-new-option', function() { $('.new-option-content').append('<div class="checkbox"> <label> <input type="checkbox"> sample </label> </div>'); });
you have execute ischeck function 1 time again 1 time append new item dynamically. instruction should part of click handler method:
$('body').on('click', '.add-new-option', function() { $('.new-option-content').append('<div class="checkbox"> <label> <input type="checkbox"> sample </label> </div>'); $('input').icheck({ checkboxclass: 'checkbox-default', radioclass: 'radio-default' }); }); here jsfiddle updated.
javascript jquery html
No comments:
Post a Comment