【问题标题】:jquery.sumoselect not showing checkboxesjquery.sumoselect 不显示复选框
【发布时间】:2016-05-27 09:27:30
【问题描述】:

我有以下代码,它动态获取数据并将其推送到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>

选项加载精美,但多选复选框未显示在每个选项旁边。我以为他们默认显示。

jsfiddle 是上述的简化版本。

JSFIDDLE

【问题讨论】:

  • 你能在Jsfiddle复制这个吗?

标签: javascript jquery sumoselect.js


【解决方案1】:

好的,呵呵,解决办法是加上“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>

【讨论】:

    猜你喜欢
    • 2013-10-06
    • 2019-12-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多