forked from marcj/jquery-selectBox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
77 lines (44 loc) · 2.43 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
** Overview **
The plugin works by piggy-backing your existing SELECT controls. Since the original controls aren’t destroyed (they’re hidden), you can easily integrate this plugin into just about any existing form. The plugin degrades gracefully, as users without JavaScript will see the default SELECT controls.
** Features **
- Supports OPTGROUPS
- Supports standard dropdown controls
- Supports multi-select controls (i.e. multiple="multiple")
- Supports inline controls (i.e. size="5")
- Fully accessible via keyboard
- Shift + click (or shift + enter) to select a range of options in multi-select controls
- Type to search when the control has focus
- Auto-height based on the size attribute (to use, omit the height property in your CSS!)
- Tested in IE7-IE9, Firefox 3-4, recent webkit browsers, and Opera
** License **
Licensed under both the MIT license and the GNU GPLv2 (same as jQuery: http://jquery.org/license)
** Usage **
Link to the JS file:
<script src="jquery.selectbox.min.js" type="text/javascript"></script>
Add the CSS file (or append contents to your own stylesheet):
<link href="jquery.selectbox.min.css" rel="stylesheet" type="text/css" />
** To create **
$("SELECT").selectBox([settings]);
** Settings **
menuTransition: ['default', 'slide', 'fade']
menuSpeed: [integer, 'slow', 'normal', 'fast']
** Methods **
To call a method use this syntax:
$("SELECT").selectBox('methodName', [options]);
create - Creates the control (default method)
destroy - Destroys the selectBox control and reverts back to the original form control
disable - Disables the control (i.e. disabled="disabled")
enable - Enables the control
value - if passed with a value, sets the control to that value; otherwise returns the current value
options - pass in either a string of HTML or a JSON object to replace the existing options
control - returns the selectBox control element (an anchor tag) for working with directly
** Events **
Events are fired on the original select element. You can bind events like this:
$("SELECT").selectBox().change( function() { alert( $(this).val() ); } );
focus - Fired when the control gains focus
blur - Fired when the control loses focus
change - Fired when the value of a control changes
** Change Log **
- Refer to jquery.selectBox.js for the full change log.
** Known Issues **
- The blur and focus callbacks are not very reliable in IE7. The change callback works fine.