我在jquery 1.4.5中有一个定价滑杆,我想在加载时更新最小/最大值。不知何故,这根本不会改变数值。
//JSON的一部分:
"stats":{"price_min":5990,"price_max":26419}}
//滑块:
<label for="filter_price">Preis:</label>
<div data-role="rangeslider" id="filter_price" style="touch-action: none;">
<input type="range" name="price_from" id="price_from" min="0" max="20000" step="100" value="<?=$filter_val['price_from']?>" data-popup-enabled="true">
<input type="range" name="price_to" id="price_to" min="0" max="20000" step="100" value="<?=$filter_val['price_to']?>" data-popup-enabled="true">
</div>
//jquery:
if (obj.hasOwnProperty('stats') && obj.stats && obj.stats.hasOwnProperty('price_min')) {
$('#price_from').slider("option", "min", obj.stats.price_min);
$('#price_to').slider("option", "min", obj.stats.price_min);
}
if (obj.hasOwnProperty('stats') && obj.stats && obj.stats.hasOwnProperty('price_max')) {
$('#price_from').slider("option", "max", obj.stats.price_max);
$('#price_to').slider("option", "max", obj.stats.price_max);
}
$('#price_from').slider("refresh", true);
$('#price_to').slider("refresh", true);
在获得json最小/最大值后,我如何更改最小/最大值,即使HTML代码已经呈现并且有一个以HTML硬编码的回退最小/最大值?