From f68826496b14f9af2ffe6a34e583bc77459a5d20 Mon Sep 17 00:00:00 2001 From: bbe Date: Thu, 5 Nov 2020 16:46:09 +0100 Subject: [PATCH] Fix the filterBuilderRemove and update var keyword to let or const --- helpdesk/static/helpdesk/filter.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/helpdesk/static/helpdesk/filter.js b/helpdesk/static/helpdesk/filter.js index 7b8165ff..142b27bb 100644 --- a/helpdesk/static/helpdesk/filter.js +++ b/helpdesk/static/helpdesk/filter.js @@ -1,24 +1,24 @@ $(document).ready(function() { $("#filterBuilderButton").click(function() { - var boxName = "#filterBox" + $("#filterBuilderSelect").val(); + const boxName = "#filterBox" + $("#filterBuilderSelect").val(); $(boxName).slideDown(); return false; }); $(".filterBuilderRemove").click(function() { - var boxName = "#" + $(this).parents(".filterBox").attr('id'); + const boxName = "#" + $(this).parents(".filterBox").attr('id'); $(boxName).slideUp(); - $(boxName).children("input:text").each(function() { + $(boxName).find("input:text").each(function() { $(this).val(""); }); - $(boxName).children("input:checkbox").each(function() { + $(boxName).find("input:checkbox").each(function() { this.checked = false; }); - $(boxName).children("select").each(function() { + $(boxName).find("select").each(function() { this.selectedIndex = -1; }); - var selectId = $(this).parents(".filterBox").attr('id'); - var attr = selectId.replace("filterBox", ""); + let selectId = $(this).parents(".filterBox").attr('id'); + const attr = selectId.replace("filterBox", ""); $("#filterBuilderSelect-" + attr)[0].disabled = ""; return false; @@ -31,9 +31,9 @@ $(document).ready(function() { * * @param {string} val name of selected filter value */ -var onFilterChange = function(val) { +const onFilterChange = function(val) { if (val) { - var boxName = "#filterBox" + val; + const boxName = "#filterBox" + val; $(boxName).slideDown(); $(boxName)[0].style.display="block";