Code Monkey home page Code Monkey logo

chinesecities.js's Introduction

ChineseCities

**省市选择插件

1.原生JS,不依赖jquery,zepto
2.前端学习交流群:814798690

快速使用

1.引用 ChineseCities.min.js
2.拷贝以下布局结构

<select id="province">
	<option value="请选择城市">请选择省份</option>
</select>
<select id="city">
	<option value="请选择城市">请选择城市</option>
</select>

3.创建ChineseCities对象:

var chineseCities = new ChineseCities({
	'province':'province', //省份ID
	'city':'city', //城市ID
	'hasSelect': function(data){
		console.log(data);
	}//选择后的回调函数
});

API文档

参数名 默认值 说明
province null 省份下拉框ID
city null 城市下拉框ID
hasSelect function(data){...} 选择后的回调,返回数据{'province':'省份名','city':'城市名'}

案例展示

查看演示

chinesecities.js's People

Contributors

chaorenzeng avatar

Stargazers

xiǎo bié shènɡ xīn hūn avatar Lean wang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.