$('.questions input').iCheck({
checkboxClass: 'icheckbox_line-blue',
radioClass: 'iradio_line-blue',
insert: '<div class="icheck_line-icon"></div>'
});
使用这种方法不适合我的需求:
$('.questions input').each(function () {
var self = $(this),
label = self.next(),
label_text = label.text();
label.remove();
self.iCheck({
checkboxClass: 'icheckbox_line-blue',
transferClasses: true,
radioClass: 'iradio_line-blue',
insert: '<div class="icheck_line-icon"></div>' + label_text
});
});
如何检索当前上下文?我想显示标签标签之间的文本。我的 html 看起来像
<div class="questions">
<div class="question">
<input type="checkbox" name="iCheck">
<label>Question answer text</label>
</div>
</div>