在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:indrimuska/jquery-editable-select开源软件地址:https://github.com/indrimuska/jquery-editable-select开源编程语言:JavaScript 54.5%开源软件介绍:jQuery Editable SelectjQuery Editable Select is a jQuery plugin that transforms a select into an input field where single elements are shown in real-time according to the entered characters. It scales down to a real select list when javascript is not available. DemoSee demos here: http://indrimuska.github.io/jquery-editable-select/ InstallationGet jQuery Editable Select from npm, bower or git:
Typings are available in the @types/jquery-editable-select package:
Include style and script in your page: <script src="//code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="//rawgithub.com/indrimuska/jquery-editable-select/master/dist/jquery-editable-select.min.js"></script>
<link href="//rawgithub.com/indrimuska/jquery-editable-select/master/dist/jquery-editable-select.min.css" rel="stylesheet"> MarkupBasic usage<select id="editable-select">
<option>Alfa Romeo</option>
<option>Audi</option>
<option>BMW</option>
<option>Citroen</option>
</select> $('#editable-select').editableSelect(); Default textThe default text showed right after the initialization. <select id="editable-select">
<option>Alfa Romeo</option>
<option selected>Audi</option>
<option>BMW</option>
<option>Citroen</option>
</select> HTML supportAll HTML tags in each <select id="editable-select">
<option>Alfa Romeo - <small><a href="http://www.alfaromeo.com/">www.alfaromeo.com</a></small></option>
<option>Audi - <small><a href="http://www.audi.com/">www.audi.com</a></small></option>
<option>BMW - <small><a href="http://www.bmw.com/">www.bmw.com</a></small></option>
<option>Citroen - <small><a href="http://www.citroen.com/">www.citroen.com</a></small></option>
</select> Scroll supportIf the height of the list rises above 160px, a scrollbar is displayed. You can change the max-height of the list box by overriding this css rule: .es-list { max-height: 160px !important; } OptionsOptions can be passed via data attributes or JavaScript. For data attributes, append the option name to
$('#editable-select').editableSelect({
effects: 'slide',
duration: 200,
appendTo: 'body'
}); Default settingsYou can change the default settings for a plugin by modifying the plugin's $.fn.editableSelect.Constructor.DEFAULTS.effects = 'slide';
// changes default for the plugin's `effects` option to `slide` Methods
|
Event | Description |
---|---|
created.editable-select | Fired after initialization. |
show.editable-select | Fired immediately when the show instance method has been called. |
shown.editable-select | Fired when the dropdown has been made visible (will wait for CSS transitions to complete). |
hide.editable-select | Fired immediately when the hide instance method has been called. |
hidden.editable-select | Fired when the dropdown has finished being hidden (will wait for CSS transitions to complete). |
select.editable-select | Fired when an option of the list has been selected. The selected $element is available as property of the event. |
// Must add event handlers before initializing jQuery Editable Select.
$('#editable-select').on('shown.editable-select', function (e) {
// do something...
}).editableSelect();
jQuery Editable Select includes support for keyboard navigation:
up, down arrow keys
You can navigate through list with keyboard arrows.
Enter
When the list is visible, by pressing Enter button you'll select the highlighted option and replace the input field value with the option label.
When the list is not visible, Enter will have a normal behavior (submitting the form, etc...)
Tab
If the dropdown list is visible, it closes the dropdown, otherwise it will be opened.
Escape
Hides the list.
Copyright (c) 2016 Indri Muska. Licensed under the MIT license.
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论