I am trying to set the value of a slider using a JavaScript after the slider has already been created and had it's value set.
I make the slider and it's text label:
$("#maxDegradationSlider").slider({
range: "min",
value: 62,
min: 0,
max: 100,
step: .25,
slide: function (event, ui) {
$("#maxDegradation").text(ui.value + "%");
}
});
$("#maxDegradation").text($("#maxDegradationSlider").slider("value") + "%");
Then I have tried to reset the value with the following methods both of which do nothing:
$("maxDegradationSlider").val(50);
I also tried:
$("maxDegradationSlider").slider("option", "value", 50);
The bigger picture is for me to set the value from a C# class.
I think you missed an id sign (#
) before the name of your element:
$('#maxDegradationSlider')
^
missing