title: jQuery UI Autocomplete onSelect rewrite
body: <p>I've got a text box that I am attaching an autocomplete function to.  As you start typing... it looks up in the database and returns/narrows down the appropriate content.  When a user selects from the returned list... an image and some other info is returned and placed in the page.  Works great.  See below:</p>
  
  <pre><code>jQuery(function ($) {
  var a = $('#artistName').autocomplete({ 
      serviceUrl: '/link/to/processor.ashx?action=artist',
      minChars:1, 
      maxHeight:400,
      width:300,
      zIndex: 9999,
      deferRequestBy: 0, 
  
      // callback function:
      onSelect: function(value, data){ 
          if (data) {
              var artistData = data.split('|');
              var src = '&lt;%= ImageServer %&gt;' + '/path/to/image/' + value + '.jpg';
              $("#artistPhoto").attr('src', src);
              $('#artistExt').remove();
  
              if (artistData[1] !== undefined &amp;&amp; artistData[1] != 0) {
                  $("#artistSection").append('&lt;div id="artistExt"&gt;&lt;span&gt;Contact me @&lt;/span&gt; 1-888-123-4567 Ext: ' + artistData[1] + '&lt;/div&gt;');
              }
          }
      }
  });    
  });
  </code></pre>
  
  <p>What I am trying to do is provide the same functionality if the user does not select from the list (for example... the user can start typing a name like "Bill" and the autocomplete will return "Bill"... but if the user doesn't select "Bill" from the returned result list and instead just types the name... obviously nothing will happen because the event is on the onSelect function).</p>
  
  <p>Can someone help me figure out how to write this in a way that fires the event onSelect, onChange, onLoad, onKeyUp, on[enter], etc... as long as there is a match?  Is it better to just look look for a value/length?  There is also a scenario that can occur where a user enters the page and the text box is pre-filled.  I would like the same display changes as the onSelect function in this case.  </p>
  
  <p>Any help would be much appreciated.  Thanks.</p>