0

Help please,

setTimeout(function() {
  var availableTags = [
    "ActionScript",
    "AppleScript",
    "Asp",
    "BASIC",
    "C",
    "C++",
    "Clojure",
    "COBOL",
    "ColdFusion",
    "Erlang",
    "Fortran",
    "Groovy",
    "Haskell",
    "Java",
    "JavaScript",
    "Lisp",
    "Perl",
    "PHP",
    "Python",
    "Ruby",
    "Scala",
    "Scheme"
  ];
  $("#tags").autocomplete({
    source: availableTags
  });
}, 100)
<link href="https://code.jquery.com/ui/1.8.0/themes/smoothness/jquery-ui.css" rel="stylesheet" />

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.8.0/jquery-ui.min.js"></script>
<div class="ui-widget">
  <label for="tags">Tags: </label>
  <input id="tags">
</div>

This code works perfect but if remove timeout function autocomplete stop working with no errors on my local machine.

Praveen Kumar Purushothaman
  • 164,888
  • 24
  • 203
  • 252

1 Answers1

0

Seemed Work fine.

setTimeout(function (){

  var availableTags = [
    "ActionScript",
    "AppleScript",
    "Asp",
    "BASIC",
    "C",
    "C++",
    "Clojure",
    "COBOL",
    "ColdFusion",
    "Erlang",
    "Fortran",
    "Groovy",
    "Haskell",
    "Java",
    "JavaScript",
    "Lisp",
    "Perl",
    "PHP",
    "Python",
    "Ruby",
    "Scala",
    "Scheme"
  ];

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

  },100);

Here is the demo - enter link description here

Daniel Smith
  • 1,626
  • 3
  • 29
  • 59
  • What exactly did you change in the code? Did you read the question? _This code works perfect but if remove timeout function autocomplete stop working with no errors on my local machine._ – Praveen Kumar Purushothaman Feb 26 '19 at 14:01