0

How can I use the autocomplete plugin on an input field depending on the 5 first characters typed dynamically. for exemple i have typed :

12345 

And I get :

12345 New York. 

What i tried is :

 var availableTags = [
  "12345 New Yord",
  "12378 Paris",
  "45687 Barcelon"
];

  $( "#tags" ).autocomplete({
  source: availableTags,
  minLength: 5
   });

The problem is : I have to complete the available tags depending on the first 5 charachters using a function

Cai
  • 1,726
  • 2
  • 15
  • 24
Liza
  • 197
  • 1
  • 15
  • What plugin are you using? Is that the only code you've used for it so far? – Skytiger Oct 06 '15 at 15:09
  • this one **https://jqueryui.com/autocomplete/** – Liza Oct 06 '15 at 15:11
  • 1
    I'm afraid I don't completely understand your question. Could you perhaps clarify on exactly what the problem is that you're having? – Skytiger Oct 06 '15 at 15:14
  • The code I used is ok, My problem is that I don't have a 'static' availableTags. I need To complete it with a function. For exemple I give the function 12345 and it returns New York – Liza Oct 06 '15 at 15:15
  • 2
    Before going any further, check out [this answer here](http://stackoverflow.com/questions/21385892/how-to-use-source-function-and-ajax-in-jquery-ui-autocomplete), in case your question has already been answered – Skytiger Oct 06 '15 at 15:18

0 Answers0