<input type="range" name="quantity" min="0" max="100">
<output for="quantity"></output>
body, html {
height: 100%;
}
body {
display: flex;
align-items: center;
justify-content: center;
}
View Compiled
const rangeInput = document.querySelector('input');
const output = document.querySelector('output');
function setDefaultState() {
output.value = rangeInput.value;
}
rangeInput.addEventListener('change', function(){
output.value = this.value;
});
document.addEventListener('DOMContentLoaded', function(){
setDefaultState();
});
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.