File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 16
16
return val . split ( / , \s * / ) ;
17
17
}
18
18
function extractLast ( term ) {
19
- return split ( term ) [ split ( term ) . length - 1 ] ;
19
+ return split ( term ) . pop ( ) ;
20
20
}
21
21
22
22
$ ( "#birds" ) . autocomplete ( {
27
27
} ,
28
28
search : function ( ) {
29
29
// custom minLength
30
- var term = extractLast ( $ ( this ) . val ( ) ) ;
30
+ var term = extractLast ( this . value ) ;
31
31
if ( term . length < 2 ) {
32
32
return false ;
33
33
}
37
37
return false ;
38
38
} ,
39
39
select : function ( event , ui ) {
40
- var terms = split ( $ ( this ) . val ( ) ) ;
40
+ var terms = split ( this . value ) ;
41
41
// remove the current input
42
42
terms . pop ( ) ;
43
43
// add the selected item
44
44
terms . push ( ui . item . value ) ;
45
45
// add placeholder to get the comma-and-space at the end
46
46
terms . push ( "" ) ;
47
- $ ( this ) . val ( terms . join ( ", " ) ) ;
47
+ this . value = terms . join ( ", " ) ;
48
48
return false ;
49
49
}
50
50
} ) ;
You can’t perform that action at this time.
0 commit comments