Jquery UI Slider trigger

Jquery UI Slider trigger


Hi
I've got a page with 6 sliders on it and each slider has a textfield
underneath it which contains the 'value' of the slider. Each slider has
three values - 0, 100, 200. These are translated into 0 years, 5 years and
10 years in the textfield.
The initial values of the sliders actually come from a database, but for
purposes here, I've put the values into an array.
This the code I'm using:
var guaranteedSliderText = new Array("0 years", "5 years", "10 years");
var guaranteedSliderValues = new Array(100, 200, 0, 0, 100, 200);
$(".guaranteeSlider").each(function(i) {
$(this).slider({
value: guaranteedSliderValues[i],
min: 0,
max: 200,
step: 100,
slide: function(event, ui) {
var thisText = "";
jQuery.each(guaranteedSliderText, function(i) {
if ((i + 1) * 100 == ui.value + 100) thisText =
guaranteedSliderText [i];
});
$("#" + $(this).attr("id") + "Value").html(thisText);
}
});
});
This is fine when you actually slide the slider. The value populates
nicely. The problem I'm having is populating the textfield on page load.
How do I trigger the slide event?
Is there a way to say something like .trigger("slide");?
Any help greatfully received.
Cheers
S
--
View this message in context: http://www.nabble.com/Jquery-UI-Slider-trigger-tp21627039s27240p21627039.html
Sent from the jQuery UI Discussion mailing list archive at Nabble.com.