js三级联动效果city-picker

链接:https://pan.baidu.com/s/1NE_EO5_xGvR-y-lboYap7g 
提取码:h00e 

效果展示:

 

解决:

动态赋值:

注意:在执行赋值之前,必须执行reset和destroy操作

<div style="position: relative;"><!-- container -->
<input id="city-picker1" readonly type="text">
  <input id="set" type="button" value="赋值"/>
</div>
<script type="text/javascript">
    $(function(){
        $("#city-picker1").citypicker();
        $("#set").click(function() {
            $("#city-picker1").citypicker("reset");
            $("#city-picker1").citypicker("destroy");
            $("#city-picker1").citypicker({
              province: '江苏省',
              city: '宿迁市',
              district: '沭阳县'
            });
        });
    });
</script>

 

posted @ 2019-02-12 14:38  kerala  阅读(739)  评论(0编辑  收藏  举报