# distpicker
**Repository Path**: ulia/distpicker
## Basic Information
- **Project Name**: distpicker
- **Description**: A simple jQuery plugin for picking provinces, cities and districts of China. (中国 / 省市区 / 三级联动 / 地址选择器)
- **Primary Language**: JavaScript
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-06-09
- **Last Updated**: 2020-12-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# Distpicker
[](https://cdnjs.com/libraries/distpicker)
> A simple jQuery plugin for picking provinces, cities and districts of China.
- [Website](https://fengyuanchen.github.io/distpicker)
## Table of contents
- [Main](#main)
- [Getting started](#getting-started)
- [Options](#options)
- [Methods](#methods)
- [No conflict](#no-conflict)
- [Browser support](#browser-support)
- [License](#license)
## Main
```
dist/
├── distpicker.js (104 KB)
└── distpicker.min.js ( 72 KB)
```
## Getting started
### Quick start
Four quick start options are available:
- [Download the latest release](https://github.com/fengyuanchen/distpicker/archive/master.zip).
- Clone the repository: `git clone https://github.com/fengyuanchen/distpicker.git`.
- Install with [NPM](https://npmjs.com): `npm install distpicker`.
- Install with [Bower](https://bower.io): `bower install distpicker`.
### Installation
Include files:
```html
```
Create HTML elements:
```html
```
### Usage
#### Initialize with `data-toggle="distpicker"` attribute
Basic
```html
```
Custom placeholders
```html
```
Custom districts
```html
```
#### Initialize with `$.fn.distpicker` method
Basic
```js
$('#target').distpicker();
```
Custom placeholders
```js
$('#target').distpicker({
province: '---- 所在省 ----',
city: '---- 所在市 ----',
district: '---- 所在区 ----'
});
```
Custom districts
```js
$('#target').distpicker({
province: '浙江省',
city: '杭州市',
district: '西湖区'
});
```
[⬆ back to top](#table-of-contents)
## Options
- Change the default options with `$().distpicker(options)`.
- Change the global default options with `$.fn.distpicker.setDefaults(options)`.
Also supports to set the options by `data-*` attributes:
```html
...
```
### autoselect
- Type: `Number`
- Options:
- `0`: Disable autoselect.
- `1`: Autoselect province only.
- `2`: Autoselect province and city only.
- `3`: Autoselect all (province, city and district).
- Default: `0`
Selects the districts automatically.
### placeholder
- Type: `Boolean`
- Default: `true`
Show placeholder (with an `