javascript - How to assign value to multiple in js into the form of multi-select box below?
天蓬老师
天蓬老师 2017-05-19 10:36:21
0
1
727


#If you want to realize the value in multiple, it will change with the changes of province, city and district.

I tried many ways to assign values ​​to multiple using js, but the value of multiple did not change.
Who knows how to solve it?

Multiple selections can be made in the multiple check box:
Picture description

Assignment code:

<select id="PositionList" multiple="multiple">
                        <c:forEach items="${sessionScope.positionl}" var="positionl">                             
                                    <option value="${positionl.name}">${positionl.name}</option>
                        </c:forEach>  
                         </select> 
              

<script type="text/javascript">

                            $(document).ready(function() {
                                $('#PositionList').multiselect();
                            });
                 </script>   
                 
                 

If js assigns a value to a general select:



success : function(data) {
                var jsonpos = data;
                var pos = "";
                for (var int = 0; int < jsonpos.length; int++) {
                    pos += "<option value="+jsonpos[int].name+">"
                            + jsonpos[int].name + "</option>";
                }
            }    

 这个就行了。但是 multiple 不能这样赋值,还请大神指教?
天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(1)
小葫芦
    document.getElementById('xxx').setAttribute('size',num) or $('xxx').attr('size',num)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template