Fix the filterBuilderRemove and update var keyword to let or const

This commit is contained in:
bbe 2020-11-05 16:46:09 +01:00
parent 77ab80672f
commit f68826496b

View File

@ -1,24 +1,24 @@
$(document).ready(function() { $(document).ready(function() {
$("#filterBuilderButton").click(function() { $("#filterBuilderButton").click(function() {
var boxName = "#filterBox" + $("#filterBuilderSelect").val(); const boxName = "#filterBox" + $("#filterBuilderSelect").val();
$(boxName).slideDown(); $(boxName).slideDown();
return false; return false;
}); });
$(".filterBuilderRemove").click(function() { $(".filterBuilderRemove").click(function() {
var boxName = "#" + $(this).parents(".filterBox").attr('id'); const boxName = "#" + $(this).parents(".filterBox").attr('id');
$(boxName).slideUp(); $(boxName).slideUp();
$(boxName).children("input:text").each(function() { $(boxName).find("input:text").each(function() {
$(this).val(""); $(this).val("");
}); });
$(boxName).children("input:checkbox").each(function() { $(boxName).find("input:checkbox").each(function() {
this.checked = false; this.checked = false;
}); });
$(boxName).children("select").each(function() { $(boxName).find("select").each(function() {
this.selectedIndex = -1; this.selectedIndex = -1;
}); });
var selectId = $(this).parents(".filterBox").attr('id'); let selectId = $(this).parents(".filterBox").attr('id');
var attr = selectId.replace("filterBox", ""); const attr = selectId.replace("filterBox", "");
$("#filterBuilderSelect-" + attr)[0].disabled = ""; $("#filterBuilderSelect-" + attr)[0].disabled = "";
return false; return false;
@ -31,9 +31,9 @@ $(document).ready(function() {
* *
* @param {string} val name of selected filter value * @param {string} val name of selected filter value
*/ */
var onFilterChange = function(val) { const onFilterChange = function(val) {
if (val) { if (val) {
var boxName = "#filterBox" + val; const boxName = "#filterBox" + val;
$(boxName).slideDown(); $(boxName).slideDown();
$(boxName)[0].style.display="block"; $(boxName)[0].style.display="block";