我想使用jQuery Dependent Selects,如果我从可用选项中选择多个值,它将获取我选择的结果。 它可以正常选择;但是如果我将select更改为多个,它将不会给出任何结果,当我提示结果时它会给出空结果。
我的代码是:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
echo'
<form method=post action="">
<select name="location[]" class="dependent-demo4" id="mydropdown" multiple>
<option></option>';
while($ro=$db->fetch_array($result)){
$bulding=$ro['bulding'];
$block=$ro['block'];
<option value='$block'> $bulding > $block </option>";
}
echo'</select><input type=submit name=submit value=submit> </form>';
<script>
$("#mydropdown").on('change', function(evt, params) {
alert($(this).val());
//alert(params.selected);
});
$(function(){
$('.dependent-demo4').dependentSelects({
labels: ['District: ', 'Region: '],
placeholderOption: ['Select a district', 'Select a region'],
placeholderSelect: ['Please select a city', 'Please select a district']
});
})
</script>