1
我使用此插件http://www.erichynds.com/examples/jquery-ui-multiselect-widget/demos/#single進行多選,並且希望單選也在同一頁面中。 基本上我有2選擇 - 一個是多個另一個是單身,但我想他們都一樣。 所以我嘗試:jquery ui multiselect無法使用多個+單選
<script type="text/javascript">
$(function(){
$("#altceva").multiselect({
multiple: false,
header: "Select an option",
noneSelectedText: "Select an Option",
selectedList: 1
});
$("#ceva").multiselect();
});
</script>
和選擇:
<select name="123_cat[]" id = "ceva" multiple="multiple" size="5">
<?php foreach($subcategories['categories'] as $sc) { ?>
<optgroup label="<?php echo $sc['name']; ?>">
<?php foreach ($sc['subcategories'] as $ss){?>
<option id = "123_cat" value="<?php echo $ss['sid']; ?>" <?php if (isset($_GET['123_cat'])) { if(in_array($ss['sid'], $_GET['123_cat'])) echo "selected = 'selected'";} else { if(in_array($ss['sid'], $the_subcategories)) echo "selected = 'selected'"; } ?>><?php echo $ss['name']; ?></option>
<?php }?>
<label for="oras">Oras</label>
<select name="123_city" id = "altceva">
<?php foreach($ac as $rc) {?>
<option id = "123_city" value="<?php echo $rc['slug']; ?>" <?php if (isset($_GET['123_city'])) { if ($rc['slug'] == $_GET['123_city']) echo 'selected = "selected"';} else { if ($rc['slug'] == $my_data->city) echo 'selected = "selected"';} ?>> <?php echo $rc['name']; ?> </option>
<?php } ?>
</select>
問題是多選的作品,但單選擇不會在所有的工作(我不能選擇任何東西,列表會下降,但沒有選擇)。 有什麼想法爲什麼?非常感謝。
您是否在控制檯中看到任何錯誤?你能否也請發佈'#ceva'選擇的HTML。 –
我編輯了問題加入選擇 – dana
解決了它!在這個插件中,單選是單選按鈕而不是複選框。我會立即張貼答案,以防萬一其他面臨這個問題:) – dana