下拉面板式省市区三级联动jquery插件,视觉更清爽,交互体验更友好。
A simple jQuery plugin for picking provinces, cities and districts of China.
##Release History
###v1.1.0 Add function to get the code:
// type: null or undefined(get the full code path, separated with /), province, city, district
$('.city-picker').data('citypicker').getCode(type);
dist/
├── city-picker.js ( 7 KB)
├── city-picker.min.js ( 4 KB)
├── city-picker.data.js (98 KB)
└── city-picker.data.min.js (68 KB)
Four quick start options are available:
git clone https://github.com/tshi0912/city-picker.git.npm install city-picker.bower install city-picker.Include files:
Create HTML elements:
data-toggle="city-picker" attributeBasic
Custom placeholders
Responsive width
Custom province/city/district
$.fn.city-picker methodBasic
$('#target').citypicker();
Custom districts
$('#target').citypicker({
province: '江苏省',
city: '常州市',
district: '溧阳市'
});
$().citypicker(options).$.fn.citypicker.setDefaults(options).BooleanfalseMake the address level more simple, e.g. 内蒙古 instead of 内蒙古自治区.
StringdistrictOnly province, province + city, or province + city + district.
Booleanfalsemake the drop down and mask span responsive on width.
Boolean请输入省/市/区Show placeholder (with an `` element).
StringnullDefines the initial value of province. If it is a existing province in city-picker.data.js, it will be selected. If not, it will be used as a placeholder.
StringnullDefines the initial value of city. If it is a existing city under the selected province, it will be selected. If not, it will be used as a placeholder.
StringnullDefines the initial value of district. If it is a existing district under the selected city, it will be selected. If not, it will be used as a placeholder.
Reset the selects to the initial states (Undo changed).
Examples:
$().citypicker('reset');
Destroy the city-picker instance, but keep the selected districts.
If you want to remove the selected districts, you can call reset method first and then call this method.
If you have to use other plugin with the same namespace, just call the $.fn.city-picker.noConflict method to revert to it.
As a jQuery plugin, you also need to see the jQuery Browser Support.
暂无开放 Issues,或尚未同步最近议题。