使用方法:
1、引入:
<link rel="stylesheet" href="css/[email protected]@hash">
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script> <script src="js/ydui.citys.js"></script> <script src="js/ydui.js"></script>
2、初始换
/** * 默认调用 */ !function () { var $target = $(‘#J_Address‘); $target.citySelect(); $target.on(‘click‘, function (event) { event.stopPropagation(); $target.citySelect(‘open‘); }); $target.on(‘done.ydui.cityselect‘, function (ret) { $(this).val(ret.provance + ‘ ‘ + ret.city + ‘ ‘ + ret.area); }); }();
/** * 设置默认值 */ !function () { var $target = $(‘#J_Address2‘); $target.citySelect({ provance: ‘广东‘, city: ‘深圳市‘, area: ‘南山区‘ }); $target.on(‘click‘, function (event) { event.stopPropagation(); $target.citySelect(‘open‘); }); $target.on(‘done.ydui.cityselect‘, function (ret) { $(this).val(ret.provance + ‘ ‘ + ret.city + ‘ ‘ + ret.area); }); }();