我正面临一些问题Jquery icheck点击触发器例如: - 这是我的功能和我想要做的......
function resetfilter() {
$('.filtercheckbox').each(function() {
var isChecked = $(this).is(':checked');
if (isChecked == true) {
$(this).trigger('click') /// this case trigger not working with iCheck Jquery Plugins . can you suggest me how to execute trigger function onclick=" resetfilter()" this function
}
});
}
<input class="icheck filtercheckbox filter-nn" type="checkbox" checked value="1">
<input class="icheck filtercheckbox filter-nn" type="checkbox" checked value="2">
<input class="icheck filtercheckbox filter-nn" type="checkbox" checked value="3">
<input class="icheck filtercheckbox filter-nn" type="checkbox" checked value="4">
<button class="btn btn-warning btn-round btn-sm" onclick="resetfilter(this);">Reset</button>
答案 0 :(得分:0)
您应该将$('.filtercheckbox')
替换为$('.filtercheckbox:checked')
并使用$().prop('checked', false)
,这些会给您:
function resetfilter() {
$('.filtercheckbox:checked').each(function() {
$(this).prop('checked', false);
});
}