drgullin / icheck

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

iCheck line remove html #280

Closed MehGokalp closed 9 years ago

MehGokalp commented 9 years ago

Hi all, I use check line. When i add html into label icheck remove it. Ex:

<input class="icheck_line" type="radio" name="t5" value="1"/>
<label><h4>Some html here<img src="bla.png" alt="Bla Bla"/></h4></label>
$('input[type="radio"].icheck_line,input[type="checkbox"].icheck_line').each(function(){
    var self = $(this),
    label = self.next(),
    label_text = label.text();
    label.remove();
    self.iCheck({
        checkboxClass: 'icheckbox_line-blue',
        radioClass: 'iradio_line-blue',
        insert: '<div class="icheck_line-icon"></div>' + label_text
    });
});

How can i fix this?

MehGokalp commented 9 years ago

Solved. Use html prop of element.

$('input[type="radio"].icheck_line,input[type="checkbox"].icheck_line').each(function(){
    var self = $(this),
    label = self.next(),
    label_text = label.html();
    label.remove();
    self.iCheck({
        checkboxClass: 'icheckbox_line-blue',
        radioClass: 'iradio_line-blue',
        insert: '<div class="icheck_line-icon"></div>' + label_text
    });
});