This repository has been archived on 2024-07-21. You can view files and clone it, but cannot push or open issues or pull requests.
java_ee_project/project2/web/resources/js/multi_function_v1.js
Chenx221 11443413a1 up
Signed-off-by: Chenx221 <chenx221@yandex.com>
2023-06-12 20:58:35 +08:00

26 lines
971 B
JavaScript

const input_min = document.querySelector("#customRange1")
const input_max = document.querySelector("#customRange2")
const value_min = document.querySelector("#score_min_value")
const value_max = document.querySelector("#score_max_value")
input_min.addEventListener("input", (event) => {
value_min.textContent = event.target.value
input_max.setAttribute("min", event.target.value)
})
input_max.addEventListener("input", (event) => {
value_max.textContent = event.target.value
input_min.setAttribute("max", event.target.value)
})
const range_enabler = document.querySelector("#range_enabler")
range_enabler.addEventListener("click", (event) => {
//if range_enabler is checked, then enable the range
//if range_enabler is unchecked, then disable the range
if (range_enabler.checked) {
input_min.disabled = false
input_max.disabled = false
} else {
input_min.disabled = true
input_max.disabled = true
}
})