0
我希望用戶檢查至少一個複選框。然後,只有這樣 - 我想向用戶顯示一個html內容 - 一個範圍選擇器。在選擇時顯示html元素
現在,當我檢查複選框列表中的至少一個選項時,它不會切換到範圍選擇器。
我目前有這樣的代碼:
<select id="select_preferences" multiple="multiple">
<option value="Anaerobic"> Do Anaerobic Routines</option>
<option value="Aerobic">Do Aerobic Routines</option>
<option value="Diet">Diet Healthy</option>
</select>
<script type="text/javascript">
$(document).ready(function() {
$('.range-slider').hide(); //hides the class "range-slider". (using a dot before the name to specify it's a selector for the class.)
$('#select_preferences').multiselect({
buttonText: function(options, select) {
return 'Look for users that:';
},
buttonTitle: function(options, select) {
var labels = [];
options.each(function() {
labels.push($(this).text());
$('.range-slider').show();
});
return labels.join(' - ');
}
});
});
</script>
<!-- html code & script for age-range selector -->
<input class="range-slider hidden" value="23" />
<script>
$(document).ready(function() {
$('.range-slider').jRange({
from: 16,
to: 100,
step: 1,
scale: [16,30,50,75,100],
format: '%s',
width: 300,
showLabels: true,
isRange : true
})});
</script>
仍然無法工作:( – osherdo