From b205e180f8f4c7e9bf6c06724eaa29f06cd7b67d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20V=C3=A9ril?= Date: Tue, 19 May 2020 10:17:55 +0200 Subject: [PATCH] Add more jQuery --- static/js/nestedCheckbox.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/static/js/nestedCheckbox.js b/static/js/nestedCheckbox.js index e6d0d7df..7452d9b6 100644 --- a/static/js/nestedCheckbox.js +++ b/static/js/nestedCheckbox.js @@ -1,14 +1,14 @@ function nestedCheckbox_change(e) { - checkbox = e.target; + checkbox = $(e.target); //Apply children - if (!checkbox.indeterminate) { - var ul = $(checkbox).parent("li").next("ul") + if (!checkbox.is(":indeterminate")) { + var ul = checkbox.parent("li").next("ul") if (ul.length != 0) { - ul.children("li").children("input[type=checkbox]").prop("checked", checkbox.checked); + ul.children("li").children("input[type=checkbox]").prop("checked", checkbox.is(":checked")); } } //Apply parent - var ul=$(checkbox).parent("li").parent("ul") + var ul=checkbox.parent("li").parent("ul") var checkbox=$(ul).prev("li").children("input[type=checkbox]") checkboxes=ul.children("li").children("input[type=checkbox]") var checkeds=Array.from(checkboxes).map(el=>el.checked)