$("input[type=checkbox]:checked").each(function() { if (this.getAttribute('layertag') === "layer" && this.getAttribute('key') === key && this.getAttribute('dataType') === dataType) { } else { $(this).prop("checked", false); $(this).attr('checked', 'checked'); $(this).attr('checked', false); $(this).removeAttr("checked"); this.checked = false; } });
参考:https://www.cnblogs.com/jpfss/p/9699476.html