Bootstrap Component
  • Home
  • Darklight
  • Datepicker
  • Dialog
  • Dropdown
  • Fileuploader
  • Floater
  • Slider
  • Switch
  • Notify
  • Others

Dropdown

Enhance original dropdown for select use.

  • Example
  • Usage
  • - Options
  • - Events

Dropdown bootstrap-dropdown.js

Examples

Dropdown is enhanced from original dropdown component. It is used as select.

  • option1
  • option2
  • option3

Usage

As use of Dropdown. To realize selector, you should add attribute data-type="selector" on the dropdown-toggle and add an span class of dropdown-value inside it.

For options list, ul should add class dropdown-options. And for option item, you can set value in li > a attribute value. If not set value, its value will be same as its html content.

<button class="btn dropdown-toggle" data-toggle="dropdown" data-type="selector">
	<span class="dropdown-value"></span>
</button>
<ul class="dropdown-menu dropdown-options">
	<li><a value="yourValue">option</a></li>
	...
</ul>

Options

Append the option name to data-, as in data-to.

Name type default description
to string Set the target input element. When user change the select option, the value of target input element will also be changed.
And other options is same to original Dropdown Component.
<input id="sel_tgt" type="hidden" />
<button class="btn dropdown-toggle" data-toggle="dropdown" data-type="selector" data-to="#sel_tgt">
	<span class="dropdown-value"></span>
</button>
<ul class="dropdown-menu dropdown-options">
	...
</ul>

Events

Event Description
change It will trigger when change its value. It'll also trigger change event for data-to element.

Build By zombieJ.