jQuery plugin for creating a selectable button from a <select> DOM element.
JavaScript Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
test
.gitignore
.travis.yml
LICENSE.MIT.txt
README.md
index.html
selectable-button.js
update-external-scripts

README.md

selectable-button.js

Build Status

A jQuery plugin for turning a <select> DOM element into a selectable button, where the button's content is the selected <option>'s content, and clicking on the button shows a dropdown of all non-selected <options>s.

This plugin generates HTML intended to be styled by Twitter Bootstrap's button dropdown menus.

Usage

Include selectable-button.js on the HTML page after jQuery:

<script src="jquery.js"></script>
<script src="selectable-button.js"></script>

Given the following <select> DOM element:

<select>
  <option>Choice 1</option>
  <option>Choice 2</option>
  <option>Choice 3</option>
  <option>Choice 4</option>
</select>

Create a selectable button with the following call:

$('select').selectableButton();

License

See LICENSE.MIT.txt, which is a standard MIT license.