How to get min, max slider value from variable.
When i try to slide, the slider is set to maximum and stops working.
If i put in min and max in numbers instead it work just fine.
Here is a fiddle showing the issue:
<INPUT TYPE="text" CLASS="slidervalue">
<DIV CLASS="slider"></DIV>
<INPUT CLASS="getmin" TYPE="text" VALUE="1">
<INPUT CLASS="getmax" TYPE="text" VALUE="10">
var getmin = $('.getmin').val();
var getmax = $('.getmax').val();
$(".slider").slider({
range: "max",
min: getmin,
max: getmax,
value: 2,
slide: function( event, ui ) {
$( ".slidervalue" ).val( ui.value );
}
});
The jQueryUI slider expects int values, not string values.
val()returns strings.If you do this it fixes your issues…
See updated js fiddle…
You’ll also have to handle NaN values, so you could also do this…
(assuming 1 & 10 are your default values).