File tree 1 file changed +19
-9
lines changed
1 file changed +19
-9
lines changed Original file line number Diff line number Diff line change 29
29
var input = this . input = $ ( "<input>" )
30
30
. insertAfter ( select )
31
31
. val ( value )
32
+ . attr ( "title" , "" )
32
33
. autocomplete ( {
33
34
delay : 0 ,
34
35
minLength : 0 ,
57
58
} ,
58
59
change : function ( event , ui ) {
59
60
if ( ! ui . item ) {
60
- var matcher = new RegExp ( "^" + $ . ui . autocomplete . escapeRegex ( $ ( this ) . val ( ) ) + "$" , "i" ) ,
61
+ var value = $ ( this ) . val ( ) ,
62
+ matcher = new RegExp ( "^" + $ . ui . autocomplete . escapeRegex ( value ) + "$" , "i" ) ,
61
63
valid = false ;
62
64
select . children ( "option" ) . each ( function ( ) {
63
65
if ( $ ( this ) . text ( ) . match ( matcher ) ) {
67
69
} ) ;
68
70
if ( ! valid ) {
69
71
// remove invalid value, as it didn't match anything
70
- $ ( this ) . val ( "" ) . attr ( "title" , value + " didn't match any item" ) . tooltip ( "open" ) ;
71
- setTimeout ( function ( ) {
72
+ $ ( this )
73
+ . val ( "" )
74
+ . attr ( "title" , value + " didn't match any item" )
75
+ . tooltip ( "open" ) ;
76
+ select . val ( "" ) ;
77
+ setTimeout ( function ( ) {
72
78
input . tooltip ( "close" ) . attr ( "title" , "" ) ;
73
79
} , 2500 ) ;
74
80
input . data ( "autocomplete" ) . term = "" ;
89
95
this . button = $ ( "<button type='button'> </button>" )
90
96
. attr ( "tabIndex" , - 1 )
91
97
. attr ( "title" , "Show All Items" )
98
+ . tooltip ( )
92
99
. insertAfter ( input )
93
100
. button ( {
94
101
icons : {
109
116
input . autocomplete ( "search" , "" ) ;
110
117
input . focus ( ) ;
111
118
} ) ;
112
-
113
- input . tooltip ( {
114
- position : {
115
- offset : ( this . button . width ( ) + 5 ) + " 0"
116
- }
117
- } ) . tooltip ( "widget" ) . addClass ( "ui-state-highlight" ) ;
119
+
120
+ input
121
+ . tooltip ( {
122
+ position : {
123
+ of : this . button
124
+ }
125
+ } )
126
+ . tooltip ( "widget" )
127
+ . addClass ( "ui-state-highlight" ) ;
118
128
} ,
119
129
120
130
destroy : function ( ) {
You can’t perform that action at this time.
0 commit comments