I have the following sliding bar and I would like to save the position of the sliding bar that is selected after a page refresh. Currently the position is being saved and only the number/value is not showing correctly. Any ideas on how to make this work?
var slider = document.getElementById("ran");
var output = document.getElementById("demo");
output.innerHTML = slider.value;
slider.oninput = function() {
output.innerHTML = this.value;
save_data();
};
function save_data() {
var input = document.getElementById("ran");
localStorage.setItem("server", input.value);
}
function load_data() {
var input = document.getElementById("ran");
input.value = localStorage.getItem("server");
}
load_data();
<span id="demo" style="font-weight: bold"></span>
<form>
<input type='range' min='0' max="24" step="1" class="slider" value="1" id='ran'/>
</form>