Industrypicker

A simple jQuery plugin for picking the Industry kinds of China.

Table of contents

Main

dist/
├── Industrypicker.js          ( 7 KB)
├── Industrypicker.data.js     (97 KB)

Getting started

Quick start

Four quick start options are available:

Installation

Include files:

<script src="/path/to/jquery.js"></script><!-- jQuery is required -->
<script src="/path/to/Industrypicker.data.js"></script>
<script src="/path/to/Industrypicker.js"></script>

Create HTML elements:

<div><!-- container -->
  <select></select><!-- 门类 -->
  <select></select><!-- 大类 -->
  <select></select><!-- 中类 -->
  <select></select><!-- 小类 -->
</div>

Usage

Initialize with data-toggle="Industrypicker" attribute

Basic

<div data-toggle="Industrypicker">
  <select></select>
  <select></select>
  <select></select>
  <select></select>
</div>

Initialize with $.fn.Industrypicker method

Basic

$('#target').Industrypicker();

Custom placeholders

$('#target').Industrypicker({
  menlei: '—— 门类 ——',
        dalei: '—— 大类 ——',
        zhonglei: '—— 中类 ——',
        xiaolei: '—— 小类 ——'
});

⬆ back to top

Options

autoSelect

Selects the city and district automatically when the province changes.

placeholder

Show placeholder (with an <option> element).

menlei门类

Defines the initial value of province <select>. If it is a existing province in Industrypicker.data.js, it will be selected. If not, it will be used as a placeholder.

dalei大类

Defines the initial value of city <select>. If it is a existing city under the selected province, it will be selected. If not, it will be used as a placeholder.

zhonglei中类

xiaolei小类

Defines the initial value of district <select>. If it is a existing district under the selected city, it will be selected. If not, it will be used as a placeholder.

⬆ back to top

Methods

reset([deep])

Reset the selects to the initial states (Undo changed).

Examples:

$().Industrypicker('reset');
$().Industrypicker('reset', true);

destroy()

Destroy the Industrypicker 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.

⬆ back to top

Browser support 浏览器支持

As a jQuery plugin, you also need to see the jQuery Browser Support.

License

MIT © LIZHAOCH

Demo:
门类
大类
中类
小类

⬆ back to top