File tree Expand file tree Collapse file tree 1 file changed +32
-12
lines changed Expand file tree Collapse file tree 1 file changed +32
-12
lines changed Original file line number Diff line number Diff line change 12
12
< script src ="../../ui/jquery.ui.autocomplete.js "> </ script >
13
13
< link rel ="stylesheet " href ="../demos.css ">
14
14
< style >
15
- .ui-button { margin-left : -1px ; }
16
- .ui-button-icon-only .ui-button-text { padding : 0.35em ; }
17
- .ui-autocomplete-input { margin : 0 ; padding : 0.48em 0 0.47em 0.45em ; }
15
+ .ui-combobox {
16
+ position : relative;
17
+ display : inline-block;
18
+ }
19
+ .ui-button {
20
+ position : absolute;
21
+ top : 0 ;
22
+ bottom : 0 ;
23
+ margin-left : -1px ;
24
+ padding : 0 ;
25
+ /* adjust styles for IE 6/7 */
26
+ * height : 1.7em ;
27
+ * top : 0.1em ;
28
+ }
29
+ .ui-autocomplete-input {
30
+ margin : 0 ;
31
+ padding : 0.3em ;
32
+ }
18
33
</ style >
19
34
< script >
20
35
( function ( $ ) {
21
36
$ . widget ( "ui.combobox" , {
22
37
_create : function ( ) {
23
- var self = this ,
38
+ var input ,
39
+ self = this ,
24
40
select = this . element . hide ( ) ,
25
41
selected = select . children ( ":selected" ) ,
26
- value = selected . val ( ) ? selected . text ( ) : "" ;
27
- var input = this . input = $ ( "<input>" )
28
- . insertAfter ( select )
42
+ value = selected . val ( ) ? selected . text ( ) : "" ,
43
+ wrapper = $ ( "<span>" )
44
+ . addClass ( "ui-combobox" )
45
+ . insertAfter ( select ) ;
46
+
47
+ input = $ ( "<input>" )
48
+ . appendTo ( wrapper )
29
49
. val ( value )
50
+ . addClass ( "ui-state-default" )
30
51
. autocomplete ( {
31
52
delay : 0 ,
32
53
minLength : 0 ,
82
103
. appendTo ( ul ) ;
83
104
} ;
84
105
85
- this . button = $ ( "<button type='button'> </button >" )
106
+ $ ( "<a >" )
86
107
. attr ( "tabIndex" , - 1 )
87
108
. attr ( "title" , "Show All Items" )
88
- . insertAfter ( input )
109
+ . appendTo ( wrapper )
89
110
. button ( {
90
111
icons : {
91
112
primary : "ui-icon-triangle-1-s"
111
132
} ,
112
133
113
134
destroy : function ( ) {
114
- this . input . remove ( ) ;
115
- this . button . remove ( ) ;
135
+ this . wrapper . remove ( ) ;
116
136
this . element . show ( ) ;
117
137
$ . Widget . prototype . destroy . call ( this ) ;
118
138
}
128
148
</ script >
129
149
</ head >
130
150
< body >
131
-
151
+
132
152
< div class ="demo ">
133
153
134
154
< div class ="ui-widget ">
You can’t perform that action at this time.
0 commit comments