Jquery UI autocomplete accessing the search term

Jquery UI autocomplete accessing the search term

Hi,

The search event handler does not have any control over the search term.

I came into this problem, when I just wanted to trim the search term before search is performed. But I could not do it inside the search event-handler. Can someone please elaborate it a bit?

  
  1. search: function( value, event ) {
  2. value = value != null ? value : this._value();

  3. // always save the actual value, not the one passed as an argument
  4. this.term = this._value();

  5. if ( value.length < this.options.minLength ) {
  6. return this.close( event );
  7. }

  8. if ( this._trigger( "search", event ) === false ) {
  9. return;
  10. }

  11. return this._search( value );
  12. },