From 9548af38e3ad72b650d26e9c2f8059e0459fe4b4 Mon Sep 17 00:00:00 2001 From: Olesya-Khulap Date: Mon, 2 Dec 2024 01:23:51 +0300 Subject: [PATCH] changed areaInput in filtration --- .../static/JavaScript/filtration_script.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lake-catalog/src/main/resources/static/JavaScript/filtration_script.js b/lake-catalog/src/main/resources/static/JavaScript/filtration_script.js index fd54127..b9110c5 100644 --- a/lake-catalog/src/main/resources/static/JavaScript/filtration_script.js +++ b/lake-catalog/src/main/resources/static/JavaScript/filtration_script.js @@ -78,15 +78,15 @@ document.addEventListener("DOMContentLoaded", () => { }); areaInput.addEventListener("input", () => { - // Проверка, чтобы значение было в допустимых пределах - if (areaInput.value < areaRange.min) { - areaInput.value = areaRange.min; - } else if (areaInput.value > areaRange.max) { - areaInput.value = areaRange.max; - } - areaRange.value = areaInput.value; - }); - + let value = parseInt(areaInput.value, 10) || 0; // Преобразуем значение в целое число + if (value < areaRange.min) { + value = parseInt(areaRange.min, 10); + } else if (value > areaRange.max) { + value = parseInt(areaRange.max, 10); + } + areaInput.value = value; // Обновляем input + areaRange.value = value; // Синхронизируем с range + }); // Обработчик кнопки поиска // searchButton.addEventListener("click", () => { // const searchQuery = document.getElementById("searchInput").value;