GithubHelp home page GithubHelp logo

rlugojr / bootstrap-selectsplitter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from x13454/bootstrap-selectsplitter

0.0 3.0 0.0 14 KB

Transforms a <select> containing one or more <optgroup> into two chained <select>

License: MIT License

bootstrap-selectsplitter's Introduction

bootstrap-selectsplitter

Presentation

Transforms a <select> containing one or more <optgroup> in two chained <select>.

This:

image1

Becomes this:

image2

Demo

See the online demo.

How to use

Create a <select> with at least one <optgroup>:

NB: each <option> of your <select> must have a unique value.

<select data-selectsplitter-selector>
  <optgroup label="Category 1">
    <option value="1">Choice 1</option>
    <option value="2">Choice 2</option>
    <option value="3">Choice 3</option>
    <option value="4">Choice 4</option>
  </optgroup>
  <optgroup label="Category 2">
    <option value="5">Choice 5</option>
    <option value="6">Choice 6</option>
    <option value="7">Choice 7</option>
    <option value="8">Choice 8</option>
  </optgroup>
  <optgroup label="Category 3">
    <option value="5">Choice 9</option>
    <option value="6">Choice 10</option>
    <option value="7">Choice 11</option>
    <option value="8">Choice 12</option>
  </optgroup>
</select>

Add the dependency files (jQuery and Bootstrap 3 CSS):

<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>

<script src="bootstrap-selectsplitter.js"></script>

Call the plugin:

$('select[data-selectsplitter-selector]').selectsplitter();

Bower

bower install bootstrap-selectsplitter

##CDN

<script src="//cdn.jsdelivr.net/bootstrap.selectsplitter/0.1.4/bootstrap-selectsplitter.min.js"></script>

##Changes 0.1.4 : Resolves an issue when selecting a first option, then another one then selecting the first one again. (Issue 9)

0.1.3 : Resolves two issues with the plugin

  • Plugin now work properly when used multiple times on the same page. (Issue 6)
  • Two jQuery selectors have been corrected. (Issue 5)

0.1.2 : Option elements are now displayed by index (Issue 3)

0.1.1 : Minimum "size" attribute for both select tags has been set to "2" (Issue 1)

0.1.0 : Initial release

Copyright and license

Copyright (C) 2015 Xavier Faucon

Licensed under the MIT license.

bootstrap-selectsplitter's People

Watchers

 avatar  avatar  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.