I'm working on a roundslider widget and I want to display units with the values. If the value is between 0 and 999, it should show "Hz" next to it. For values between 1000 and 999999, "KHz" should be displayed, and so on.
Below is the original slider configuration:
$("#slider").roundSlider({
sliderType: "min-range",
radius: 150,
handleSize: "+12",
mouseScrollAction: true,
min: 0,
max: 100000000,
value: 0, // default value on start
change: function(event) {
$.getJSON('/set_Frequency/' + event.value);
}
});
Here is my attempt that is not functioning correctly:
$("#slider").roundSlider({
sliderType: "min-range",
radius: 150,
handleSize: "+12",
mouseScrollAction: true,
min: 0,
max: 100000000,
value: 0, // default value at start
change: function(event) {
var value = event.value, content;
if (value <= 999) content = "Hz";
else if (value <= 999999) content = "KHz";
else if (value >= 1000000) content = "MHz";
else content = "GHz";
$.getJSON('/set_Frequency/' + event.value + content);
}
});
Any assistance would be appreciated. Thank you.