[英]jquery.sumoselect not showing checkboxes
I have the following code, which fetches data dynamically and shoves it into a sumoselect . 我有以下代码,该代码动态获取数据并将其推入sumoselect 。
<select id="geoSel_location_2">
</select>
<script type="text/javascript">
jQuery(document).ready(function() {
var returnSelect = jQuery('#geoSel_location_2');
returnSelect.SumoSelect({placeholder: 'All Suburbs'});
jQuery.getJSON("/cfcs/system.cfc?method=getSelectsRelated&returnformat=json&queryformat=column",{"type":"location","id":4,"index":2},function(res,code) {
if(res.ROWCOUNT > 0){
for(i=0; i<res.ROWCOUNT; i++){
var val = res.DATA.OPTION_VALUE[i];
var text = res.DATA.OPTION_TEXT[i];
returnSelect[0].sumo.add(val,text);
};
};
});
})
</script>
The options load beautifully, but the multi-select checkboxes are not showing next to each option. 这些选项加载精美,但是在每个选项旁边未显示多选复选框。 I thought they showed by default.
我以为他们默认显示。
The jsfiddle is a simplified version of the above. jsfiddle是上面的简化版本。
OK, duh, the solution is to add "multiple="multiple", ie 好的,解决办法是添加“ multiple =“ multiple”,即
<select "multiple="multiple" id="geoSel_location_2">
<option value="1">Auckland</option>
<option value="2">Wellington</option>
<option value="3">Christchurch</option>
<option value="4">Dunedin</option>
</select>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.