title: Why do I receive an "Object does not support autocomplete jquery method" runtime error when implementing my autocomplete?
body: <p>I have realised that for my autocomplete I don't really need to work with an ajax call(I have seen many examples that worked with ajax call), I can simply work with the following:</p>
  
  <pre><code>$(document).ready(function () {
      var myData = jQuery.parseJSON(getProjects());
      $("#inputSearchProject.ClientID").autocomplete(myData);
  });   
  </code></pre>
  
  <p>Where, <code>getProjects()</code> is a small script and <code>TheProjects</code> is a property that it is initialized with the suggestion JSON string for my autocomplete.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function getProjects() {
          return '&lt;%= this.TheProjects %&gt;';
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>When debugging I have noticed that myData receives the values, but I still get an runtime error : "Microsoft JScript runtime error: Object doesn't support property or method 'autocomplete'" - even though I have searched, I haven't found the answer to this.</p>
  
  <p>EDIT: I have solved the error (it was a silly one:) novice kind of mistake)</p>
  
  <p>I have changed my code into:</p>
  
  <pre><code>$(document).ready(function () {
       var myData = jQuery.parseJSON(getProjects());
       $("[id$='txtSearchProject']").keypress(function () 
     {
       $("[id$='txtSearchProject']").autocomplete(myData);
    })
   });
  </code></pre>
  
  <p>because I want autocomplete to be started only when it detects I have written something in the input control. Do you have any suggestions why it doesn't work?</p>
  
  <hr>
  
  <p>Thank you all for your suggestions. I have solved my problem, but only with the tips I have received from you. I am going to put here my small piece of code, maybe someone with a similar question will find it useful in the future:</p>
  
  <pre><code>$(document).ready(function () {
   var myData = jQuery.parseJSON(getProjects());
   $("[id$='txtSearchProject']").keypress(function () 
    {
         $("[id$='txtSearchProject']").autocomplete({ source: myData});
    })
  });
  </code></pre>
  
  <p>//I have added instead of .autocomplete(my data) --->.autocomplete({ source: myData})</p>