문제

In this demo: http://jqueryui.com/autocomplete/#multiple

Whenever you manually type in a term and press ", ", the autocomplete automatically displays a list of all terms, which can be troublesome if you have a list of 100,000 terms.

So how do you stop autocomplete from activating after ", "?

And how do you set a minimum length for each term in the input before autocomplete activates?

도움이 되었습니까?

해결책

To handle events when typing and after searching:

  $('.selector').on( "autocompletesearch", function( event, ui ) {
      var text=$('.selector').val();
      if(text[text.length-1]==',') //This validation will do the trick you want (ie: prevent to load everything after you type a ",")
          event.preventDefault();
  } );

jsfiddle

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top