记住用户名密码
引入四个文件
jquery.js (请把这个放首位引入)
city-picker.data.js (全国省市区数据都在这个文件里面)
city-picker.js (js实现功能逻辑)
city-picker.css (省市区县选择器样式,这个也可以不用,可以自己写个更好看的)
html页面代码:
|
1
2
3
|
<div style="position: relative;"> <input class="form-control" readonly type="text" data-toggle="city-picker" style="width:50%;"></div> |
用data-toggle="city-picker"属性初始化
基本
|
1
2
3
|
<div style="position:relative;"> <input readonly type="text" data-toggle="city-picker"></div> |
自定义占位符
|
1
2
3
|
<div style="position:relative;"> <input readonly type="text" data-toggle="city-picker" placeholder="customized placeholder..."></div> |
响应宽度
|
1
2
3
|
<div style="position:relative;"> <input readonly type="text" data-toggle="city-picker" data-responsive="true" style="width:50%;"></div> |
自定义省/市/区
|
1
2
3
|
<div style="position:relative;"> <input readonly type="text" data-toggle="city-picker" value="江苏省/常州市/溧阳市"></div> |
用$.fn.city-picker方法初始化
基本
|
1
|
$('#target').citypicker(); |
定制区域
|
1
2
3
4
5
|
$('#target').citypicker({ province: '江苏省', city: '常州市', district: '溧阳市'}); |
目前有 1 条留言 其中:访客:0 条, 博主:0 条