Some codes ...
$(function () {
var select = $("#drp_riskcategory");
var drpMin = $("#hdnRiskMin").val();
var drpMax = $("#hdnRiskMax").val();
$("#slider_riskcategory").slider({
min: drpMin,
max: drpMax,
range: "min",
value: select[0].selectedIndex + 1,
slide: function (event, ui) {
select[0].selectedIndex = ui.value - 1;
},
stop: function (event, ui) { drawChart(false); }
});
select.change(function () {
$('#slider_riskcategory').slider("value", this.selectedIndex + 1);
});
$('#slider_riskcategory').slider("value", this.selectedIndex + 1);
});
<body>
<p>
<select id="drp_riskcategory" name="drp_riskcategory">
<option value="5">Defensive</option>
<option value="6">Cautious</option>
<option value="7" selected="selected">Balanced</option>
<option value="8">Capital Growth</option>
<option value="9">Aggressive</option>
</select>
</p>
<div id="slider_riskcategory" style="width:200px">
</div>
<input type="hidden" value="5" id="hdnRiskMin" />
<input type="hidden" value="9" id="hdnRiskMax" />
</body>
The above code causes "f to be undefined" when moving the slider.
The min max values ββare dynamic and are added from the code behind, I think this may be my problem
Any pointers really appreciated.
JQuery jquery version-1.4.4.min.js
Solved
It turns out that the values ββof the options screw it, set them in the range from 1 to 5, and not from 5 to 9, and everything was fine.
source
share