Skip to content

Instantly share code, notes, and snippets.

@aimahdi
Created August 28, 2021 10:28
Show Gist options
  • Save aimahdi/68326b8559f4d39bffb33af66259977f to your computer and use it in GitHub Desktop.
Save aimahdi/68326b8559f4d39bffb33af66259977f to your computer and use it in GitHub Desktop.
This code will customize range slider's value and process
(function(){
let sliderValue = document.querySelector('.ff_range_value');
var number = 0;
sliderValue.insertAdjacentHTML('afterend', `<span class=range_calc style='display: block; width: 100%; text-align: center; font-size: 32px; font-weight: 600;'>$0</span>`);
document.querySelector('.range_calc').insertAdjacentHTML('afterend', "<span class='text' style='display: block; width: 100%; text-align: center; font-size: 32px; font-weight: 600;'> Potential Earnings </span>");
number = document.querySelector('.ff_range_value').innerText.split('$');
number = number[0]*15;
document.querySelector('.range_calc').innerText =`$${number}`;
document.querySelector('[data-name="rangeslider"]').onchange= function(){
number = document.querySelector('.ff_range_value').innerText.split('$');
number = number[0]*15;
document.querySelector('.range_calc').innerText =`$${number}`;
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment