Include files:
<script src="/path/to/jquery.js"></script><!-- jQuery is required -->
<script src="/path/to/distpicker.js"></script>
Create HTML elements:
<div><!-- container -->
<select></select><!-- province -->
<select></select><!-- city -->
<select></select><!-- district -->
</div>
data-toggle="distpicker"
attributeHTML:
<div data-toggle="distpicker">
<select></select>
<select></select>
<select></select>
</div>
Demo:
HTML:
<div data-toggle="distpicker">
<select data-province="---- 选择省 ----"></select>
<select data-city="---- 选择市 ----"></select>
<select data-district="---- 选择区 ----"></select>
</div>
Demo:
HTML:
<div data-toggle="distpicker">
<select data-province="浙江省"></select>
<select data-city="杭州市"></select>
<select data-district="西湖区"></select>
</div>
Demo:
$.fn.distpicker
methodHTML:
<div id="distpicker1">
<select></select>
<select></select>
<select></select>
</div>
JavaScript:
$("#distpicker1").distpicker();
Demo:
HTML:
<div id="distpicker2">
<select></select>
<select></select>
<select></select>
</div>
JavaScript:
$("#distpicker2").distpicker({
province: '---- 所在省 ----',
city: '---- 所在市 ----',
district: '---- 所在区 ----'
});
Demo:
HTML:
<div id="distpicker3">
<select></select>
<select></select>
<select></select>
</div>
JavaScript:
$("#distpicker3").distpicker({
province: '浙江省',
city: '杭州市',
district: '西湖区'
});
Demo:
Supports to set the options by data-*
attributes:
HTML:
<div data-toggle="distpicker" data-autoselect="3" data-province="浙江省">
<select></select>
<select></select>
<select></select>
</div>
Demo:
You can call methods by $().distpicker('method', arg1, arg2, ..., argN)
.
HTML:
<div id="distpicker">
<select></select>
<select></select>
<select></select>
</div>
JavaScript:
$("#distpicker").distpicker({
province: '福建省',
city: '厦门市',
district: '思明区'
});
Demo:
HTML:
<div data-toggle="distpicker">
<select></select>
<select></select>
</div>
Demo:
HTML:
<div data-toggle="distpicker">
<select></select>
</div>
Demo:
HTML:
<div data-toggle="distpicker" data-autoselect="1">
<select></select>
<select></select>
<select></select>
</div>
Demo:
HTML:
<div data-toggle="distpicker" data-autoselect="2">
<select></select>
<select></select>
<select></select>
</div>
Demo:
HTML:
<div data-toggle="distpicker" data-autoselect="3">
<select></select>
<select></select>
<select></select>
</div>
Demo:
HTML:
<div data-toggle="distpicker" data-placeholder="false">
<select></select>
<select></select>
<select></select>
</div>
Demo:
HTML:
<div data-toggle="distpicker" data-value-type="code">
<select data-province="330000"></select>
<select data-city="330100"></select>
<select data-district="330106"></select>
</div>
Demo: