I am try to change the background color of slider.But my code is not working properly. Can anyone help me please?
here is my code
html
<a href="#" @click.prevent="redColor">Change Color</a>
<input type="range" :class="{background:fillColor}" class="slider-range" id="range" value="0" name="range" min="0" step="1" max="8">
js code
var vm = new Vue({
el:'#app',
data:{
fillColor:''
},
methods:{
redColor:function(){
this.fillColor = 'linear-gradient(90deg, #f5f4f4 0, rgb(209, 39, 16) 100%)';
},
}
});
class, not thestyleon the element… although I do recommend setting/changing the class and then use CSS to apply the linear-gradient style to that class.styleinstead ofclass<input type="range" class="active"…>where you'll be adding & removing the "active" class as needed. Then create a style in CSS that saysinput.active { …linear-gradient(… }— No more fiddling with styles in your code, which shouldn't care about style, it should care about state.