我将值检查点复制到另一个块。通过单击新元素,必须将其删除并选择过滤器。请帮忙找出错误。
$('.views-exposed-widget').on('change', 'input', function () {
var self = $(this),
name = this.name,
text = self.closest('.form-type-radio').find('label[class="option"]').text(),
target = $('.duplicate-filter').find('[data-for="'+ name +'"]');
if (target.length == 0){
target = $('<span class="o_filt" data-for="'+name+'"></span>').appendTo('.duplicate-filter');
}
target.text( text );
$('.o_filt').on('click', function(){
var l = $(this).text();
m = $('.views-exposed-form .form-type-radio label.option');
$(this).remove();
m.each(function(){
if($(this).text().indexOf(l)!=-1){
$(this).closest('input[type="radio"].dls-radio').removeAttr('checked');
}
});
});
});
答案 0 :(得分:1)
像这样使用.prop('checked', false)
:
$('.o_filt').on('click', function () {
var l = $(this).text();
$(this).remove();
$('input[name="' + $(this).data('for') + '"]').prop('checked', false);
});