I am facing difficulty in selecting a CSS class named .slider::-webkit-slider-thumb to modify a property. Despite trying various options, JavaScript doesn't seem to be targeting it.
document.addEventListener("DOMContentLoaded", function (event) {
var slider = document.getElementById("importanceSlider");
var knob = document.getElementsByClassName(".slider::-webkit-slider-thumb");
knob.style.background = "#ffffff"; });
CSS:
.slidercontainer{
width: 100%;
}
.slider {
-webkit-appearance: none;
width: 100%;
height: 25px;
background: #e9ecef;
outline: none;
border-radius: 50px;
}
.slider::-webkit-slider-thumb {
-webkit-appearance: none;
width: 10%;
height: 25px;
background: #dc3545;
border-radius: 50px;
}
HTML:
<div class="slidecontainer">
<input type="range" min="0" max="10" value="5"
class="slider" id="importanceSlider" name="importance">
</div>
I am looking to dynamically change the width value of .slider::-webkit-slider-thumb based on the slider input.
Your assistance with this matter would be highly appreciated.