title: jQuery autocomplete search and select programmatically
body: <p>I have a data from my controller and when the page loads I want the autocomplete input to search for that data and select it.</p>
  
  <p>I am able to search the data using: </p>
  
  <p><code>$( "#autocomplete" ).autocomplete( "search", '&lt;?=$ID?&gt;' );</code></p>
  
  <p>above code works and showing the correct value of autocomplete. Now I cant select the value so that the autocomplete input triggers change. I wanted the input to trigger change because I will auto populate some input.</p>
  
  <p>The way I select the value pro grammatically is :</p>
  
  <p><code>select: function( event, ui ) {}</code></p>
  
  <p>Now i found this:</p>
  
  <p><code>search: function( event, ui ) {},</code></p>
  
  <p>Is is possible to combine the two?</p>
  
  <p>How to select searched data from auto complete programmatically ?</p>
  
  <p>Update:</p>
  
  <p>This is how my autcomplete works:</p>
  
  <pre><code>$( ".updatedautocomplete" ).autocomplete({
        source:function(request,response){
           var $this = $(this);
           $.post("url",{
              term:request.term
           }).done(function(data, status){
              response($.map( data, function( item ) {
                  return {
                      data
                  }
                  return false; // Prevent the widget from inserting the value.
              }));
  
          });
        },
        select: function( event, ui ) {
           $( this ).attr( 'data-value' , ui.item.id );
           $( this ).attr( 'data-asd' , ui.item.sad );
           $( this ).val( ui.item.label );
           $( "#modal" ).val( ui.item.qwe.trim() );
           $( "#modal" ).val( ui.item.asd.trim() );
           $( "#modal" ).val( ui.item.zxc.trim() );
           $( "#modal" ).val( ui.item.ert.trim() );
           $( "#modal" ).val( ui.item.dfg.trim() );
          return false;
        }
      });
  </code></pre>
  
  <p>The reason why I wanted select event is to populate some input as shown in the source</p>