I need to select a css class named .slider::-webkit-slider-thumb to change a property. I have tried a multiple array of options, but JS doesn't seem to select 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 want to change the width value of .slider::-webkit-slider-thumb in particular, depending on the value of the slider.
Any help would be appreciated