JQuery Slider does not match tenth value
I have a JQuery slider that works really well, but for some reason it doesn't pass the tenth value.
$(document).ready(function(){
$("#scoreSlider").slider({
'steps': 40,
'min': 1.0,
'max': 5.0,
'startValue': 3,
'slide': function(e, ui){
document.getElementById('div_score').innerHTML = ui.value;
}
});
});
The slider seems to have the correct number of clicks, but the passed value only has integers.
Any ideas.
+1
source to share
1 answer
According to the documentation for Slider ,
ui.value: Integer - the current value of the descriptor
Why don't you change your code to this:
$(document).ready(function(){
$("#scoreSlider").slider({
'steps': 40,
'min': 10,
'max': 50,
'startValue': 30,
'slide': function(e, ui){
document.getElementById('div_score').innerHTML = ui.value/10.0;
}
});
});
It seems that you are getting the decimal values you want.
+3
source to share