# city-picker
**Repository Path**: mirrors_singod/city-picker
## Basic Information
- **Project Name**: city-picker
- **Description**: The city-picker,A simple jQuery plugin for picking provinces, cities, districts and towns of China.(中国 / 省市区县 / 四级联动 / 地址选择器)
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-09-25
- **Last Updated**: 2026-03-22
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# City Picker
> A simple jQuery plugin for picking provinces, cities and districts of China.
- [Demo](https://huangchanghuan.github.io/city-picker)
- [博客园更简单使用说明](http://www.cnblogs.com/huangchanghuan/p/6681510.html)
##Release History
###v1.1.0
Add function to get the code:
```javascript
// type: null or undefined(get the full code path, separated with /), province, city, district
$('.city-picker').data('citypicker').getCode(type);
```
## Main
```
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)
```
## Getting started
### Quick start
Four quick start options are available:
- [Download the latest release](https://github.com/tshi0912/city-picker/archive/master.zip).
- Clone the repository: `git clone https://github.com/tshi0912/city-picker.git`.
- Install with [NPM](http://npmjs.org): `npm install city-picker`.
- Install with [Bower](http://bower.io): `bower install city-picker`.
### Installation
Include files:
```html
```
Create HTML elements:
```html
```
### Usage
#### Initialize with `data-toggle="city-picker"` attribute
Basic
```html
```
Custom placeholders
```html
```
Responsive width
```html
```
Custom province/city/district
```html
```
#### Initialize with `$.fn.city-picker` method
Basic
```js
$('#target').citypicker();
```
Custom districts
```js
$('#target').citypicker({
province: '江苏省',
city: '常州市',
district: '溧阳市'
});
```
## Options
- Change the default options with `$().citypicker(options)`.
- Change the global default options with `$.fn.citypicker.setDefaults(options)`.
### simple
- Type: `Boolean`
- Default: `false`
Make the address level more simple, e.g. `内蒙古` instead of `内蒙古自治区`.
### level
- Type: `String`
- Default: `district`
Only province, province + city, or province + city + district.
### responsive
- Type: `Boolean`
- Default: `false`
make the drop down and mask span responsive on width.
### placeholder
- Type: `Boolean`
- Default: `请输入省/市/区`
Show placeholder (with an `