I need some help with jQuery UI slider, I have set the initial value but I can't seem to find a way to display it when the page loads. I also need to be able to call both slider values to a function to do a calculation, then display it to the screen.
You can view my Fiddle test here > http://jsfiddle.net/cC3Qh/
jQuery
$(function() {
$( "#slider1").slider({
max: 2500,
value: 1000,
slide: function( event, ui ) { $( "#slider-result1" ).html( ui.value ); },
change: function(event, ui) { calPrice(ui.value); }
});
$( "#slider2").slider({
max: 30,
value: 12,
slide: function( event, ui ) { $( "#slider-result2" ).html( ui.value ); },
change: function(event, ui) { calDays(ui.value); }
});
});
function calDays(sliderval){
var day = sliderval;
day = day * 100;
document.getElementById('price2').innerHTML = day;
var price = document.getElementById('price1').innerHTML;
price = price * day;
document.getElementById('price3').innerHTML = price;
}
function calPrice(sliderval){
var price = sliderval;
price = price * 100;
document.getElementById('price1').innerHTML = price;
}
Thanks.