title: How to trigger jquery autocomplete manually on keyup
body: <p>I want to trigger the jquery autocomplete manually on keyup, only after pressing the asterisk "*" by the end of the input.</p>
  
  <p>Here's what I did:</p>
  
  <pre><code>&lt;input type="text" name="test" id="mainSearchBox"&gt;
  
  var availableTags = [
     "Perl",
     "PHP",
     "Python",
     "Ruby"
  ];
  $('input#mainSearchBox').keyup(function(){
      var value = $('input#mainSearchBox').val();
      if(value.substr(value.length - 1) == "*"){
          $(this).autocomplete({
              source: availableTags,
              minLength:0
          });
      } else {
          $(this).autocomplete("close");
      }
  });
  </code></pre>
  
  <p><a href="http://jsfiddle.net/W56yq/152/" rel="nofollow">jsfiddle</a></p>