Giter Site home page Giter Site logo

jquery-linkage-select's Introduction

基于jquery的联动下拉框组件

用法

  1. 在页面中加入jquery和联动下拉组件的脚本
    <script src="pathTo/jquery.js"></script>
    <script src="pathTo/jquery-linkage-select.js"></script>
  2. 初始化
$(selector).linkage({
	url: Function/urlString,// 如果数据是异步的,数据的请求地址,可以是字符串或生成url地址的函数
	data: data, // 如果数据是同步的
	/* 格式化data。
	格式化后返回的数据形如[{value:XXX,text:XXX}]。其中value为option的value,text为option的显示文本。
	@param data在同步时即为传入的data。异步时为异步返回的data。
	@param selectedVal为前一个联动框的value
	*/
    format: function(data, selectedVal) {},
    afterRender: function($sel) {//select渲染好之后的回调
        console.log('prov rendered!', $sel);
    },
    next: $(nextSel).linkage(options),// 联动的下一个框。
    isRoot: Boolean,// 是否是联动的第一个框。默认是false。
    forceEmpty: Boolean,//渲染select时,是否清空,默认为true
    initOpt: '<option value="">不限</option>'// select的初始值
});

更多见demo

jquery-linkage-select's People

Contributors

iamjoel avatar

Watchers

 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.