I would like some help with getting this range slider to give multiple outputs. I've tried a few different things but I can't seem to figure it out.
I would like the "590" text to be 5.9x the slider value with commas if the number reaches the thousands I would like the "30,000" text to be 300x the slider value also with commas
[JSFiddle Demo]
var elem = document.querySelector('input[type="range"]');
var rangeValue = function(){
var newValue = elem.value;
var target = document.querySelector('.value');
target.innerHTML = newValue;
}
elem.addEventListener("input", rangeValue);
@import url(https://fonts.googleapis.com/css?family=Work+Sans:300);
body {
font-family: "Work Sans", Helvetica, Arial, sans-serif;
color: #d7d7d7;
padding-top: 40px;
text-shadow: white 1px 1px 1px;
}
.value {
text-align: center;
font-weight: 300;
font-size: 10em;
width: 300px;
height: 100px;
line-height: 60px;
letter-spacing: -.03em;
margin: 40px auto;
}
input[type="range"] {
display: block;
-webkit-appearance: none;
background-color: #ffa842;
width: 300px;
height: 5px;
border-radius: 5px;
margin: 0 auto;
outline: 0;
}
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
background-color: #f5a623;
width: 30px;
height: 30px;
border-radius: 50%;
border: 2px solid white;
cursor: pointer;
transition: .3s ease-in-out;
}
input[type="range"]::-webkit-slider-thumb:hover {
background-color: white;
border: 2px solid #f5a623;
}
input[type="range"]::-webkit-slider-thumb:active {
transform: scale(1.6);
}
<div class="value">100</div>
<input type="range" min="100" max="1000" step="10" value="100">
<br><br>
<strong><span class="perYear" id="perYear" style=" font-size: 70px; font-weight: 700; color: #ff9600;">590</span></strong>
<br><br>
<strong><span class="perTwentyFive" id="perTwentyFive" style=" font-size: 70px; font-weight: 700; color: #ff9600;">30,000</span></strong>