Simple jQuery Plugin For Chained Selects - Chained

Simple jQuery Plugin For Chained Selects - Chained
File Size: 325 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Chained is a lightweight and simple jQuery plugin for chained selects that allow to choose child selects from two different versions of your select lists. The plugin also provides a remote version (jquery.chained.remote.js) which makes an external Ajax query and uses the returned JSON to build child selects.

Installation:

# NPM
$ npm install jquery-chained

# Bower
$ bower install jquery-chained

Basic Usage:

1. Include jQuery javascript library and jQuery Chained Plugin in your html document

<script src="http://code.jquery.com/jquery-latest.min.js"></script> 
<script src="jquery.chained.js"></script> 

2. Create the html

<select id="mark" name="mark">
  <option value="">--</option>
  <option value="bmw">BMW</option>
  <option value="audi">Audi</option>
</select>
<select id="series" name="series">
  <option value="">--</option>
  <option value="series-3" class="bmw">3 series</option>
  <option value="series-5" class="bmw">5 series</option>
  <option value="series-6" class="bmw">6 series</option>
  <option value="a3" class="audi">A3</option>
  <option value="a4" class="audi">A4</option>
  <option value="a5" class="audi">A5</option>
</select>

3. The javascript

$("#series").chained("#mark");

Change logs:

v1.0.1 (2017-05-20)

  • Remove invisible control character

v1.0.1 (2017-03-24)

  • Use length instead of .size()

v0.9.10 (2015-02-26)

v0.9.10 (2014-02-28)

  • update.

v0.9.9 (2013-12-19)

  • Do not trigger change event if value of select does not change
  • Rename "values" setting to more logical "depends".

v0.9.7 (2013-10-27)

  • Zepto support.
  • Bower support.
  • Ability to bootstrap selects by passing JSON data in settings. Avoids making the initial AJAX calls.
  • Alternate but prettier syntax for remote version. Allow you to pass all settings as one hash.
  • Optionally send additional values of non chained inputs when using remote version
  • Removed unneeded files when installing with Bower.

This awesome jQuery plugin is developed by tuupola. For more Advanced Usages, please check the demo page or visit the official website.