From 7414759d9ddf66800ef6857de30dd46722c7464b Mon Sep 17 00:00:00 2001 From: revengeday Date: Fri, 15 Nov 2024 21:57:02 +0000 Subject: [PATCH] Function for the slider added --- js/slider.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 js/slider.js diff --git a/js/slider.js b/js/slider.js new file mode 100644 index 0000000..4a371ce --- /dev/null +++ b/js/slider.js @@ -0,0 +1,14 @@ +function initializeSlider() { + const slider = document.getElementById("countSlider"); + const display = document.getElementById("sliderValueDisplay"); + + display.innerText = slider.value; + slider.addEventListener("input", function () { + display.innerText = this.value; + }); +} + +function getSliderValue() { + const slider = document.getElementById("countSlider"); + return parseInt(slider.value); +} \ No newline at end of file