From b8e352145c9e3662dc0ec8e32944848186494de3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Thu, 13 Aug 2020 00:20:35 +0200 Subject: [PATCH] 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. --- app/assets/javascripts/legislation_admin.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/assets/javascripts/legislation_admin.js b/app/assets/javascripts/legislation_admin.js index efc7bf4ff..b63fec903 100644 --- a/app/assets/javascripts/legislation_admin.js +++ b/app/assets/javascripts/legislation_admin.js @@ -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");