title: How do I get the jQuery UI autocomplete value from outside an onchange event?
body: <p>I'm using jQuery UI 1.12.  I have an input field that I turn into an autocomplete select using the code</p>
  
  <pre><code>$("#myFilter").autocomplete({source: myItems});
  </code></pre>
  
  <p>I then auto-select an item upon initialization using</p>
  
  <pre><code>$("#myFilter").autocomplete("search", defaultValue);
  </code></pre>
  
  <p>My question is, how do I get the selected ID of the item that's selected?  If I were in an "onchange" event, I could do</p>
  
  <pre><code>$( "#myFilter" ).on( "autocompleteselect", function( event, ui ) {
  
      var id = ui.item.value;
  </code></pre>
  
  <p>However, I am not in the onchange event, and as such I'm not sure how to extract the selected value.</p>