Use prop() instead of removeAttr()

According to the jQuery upgrade guide:

> It is almost always a mistake to use .removeAttr("checked") on a DOM
> element. The only time it might be useful is if the DOM is later going
> to be serialized back to an HTML string. In all other cases,
> .prop("checked", false) should be used instead.
This commit is contained in:
Javi Martín
2020-08-13 00:20:35 +02:00
committed by Senén Rodero Rodríguez
parent 996062fa19
commit b8e352145c

View File

@@ -8,11 +8,7 @@
checkbox = $(this);
checkbox.closest("fieldset").find("input[type='date']").each(function() {
if (checkbox.is(":checked")) {
$(this).removeAttr("disabled");
} else {
$(this).prop("disabled", true);
}
$(this).prop("disabled", !checkbox.is(":checked"));
});
}
}).trigger("change");