title: jQuery UI autocomplete submit onclick result
body: <p>I've been trying to figure out how to submit the form when the person selects the result from choices of the autocomplete. It needs to work with a mouse click or enter button. I see examples out there but always in pieces. No one shows the entire function.</p>
  
  <p>I have this code below but I get errors saying result is not a function. I don't know how to combine this to do what I would like. Any help is appreciated.</p>
  
  <pre><code>jQuery(document).ready(function(){  
  
  jQuery("#vsearch").autocomplete("ajax/search.php",
      {
      minLength: 2
  }
  );
  jQuery("#vsearch").result(function(event, data, formatted) {
        jQuery('#vsearch').value( formatted );
        jQuery('#search').submit();
  });
  });
  </code></pre>