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 1616 return val . split ( / , \s * / ) ;
1717 }
1818 function extractLast ( term ) {
19- return split ( term ) [ split ( term ) . length - 1 ] ;
19+ return split ( term ) . pop ( ) ;
2020 }
2121
2222 $ ( "#birds" ) . autocomplete ( {
2727 } ,
2828 search : function ( ) {
2929 // custom minLength
30- var term = extractLast ( $ ( this ) . val ( ) ) ;
30+ var term = extractLast ( this . value ) ;
3131 if ( term . length < 2 ) {
3232 return false ;
3333 }
3737 return false ;
3838 } ,
3939 select : function ( event , ui ) {
40- var terms = split ( $ ( this ) . val ( ) ) ;
40+ var terms = split ( this . value ) ;
4141 // remove the current input
4242 terms . pop ( ) ;
4343 // add the selected item
4444 terms . push ( ui . item . value ) ;
4545 // add placeholder to get the comma-and-space at the end
4646 terms . push ( "" ) ;
47- $ ( this ) . val ( terms . join ( ", " ) ) ;
47+ this . value = terms . join ( ", " ) ;
4848 return false ;
4949 }
5050 } ) ;
You can’t perform that action at this time.
0 commit comments