title: $.ui is undefined inside autocomplete and ui plugins
body: <p>I'm trying to use jquery autocomplete on a text field to allow users to select multiple tags as in <a href="http://jqueryui.com/demos/autocomplete/#multiple" rel="nofollow">this example</a>, but I'm getting the error <code>Uncaught TypeError: Cannot read property 'autocomplete' of undefined</code>. Here's the code causing the problem, mosly copied from the link. </p>
  
  <pre><code>&lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  var tags = [&lt;?php
  foreach($this-&gt;tags as $tag){
      echo "\"{$tag['name']}\",";
  }
  ?&gt;""];
  
  $( "textarea:[name='tags']" ).autocomplete({
      minLength: 0,
      source: function( request, response ) {
          // delegate back to autocomplete, but extract the last term
          alert($.ui);
          $.noConflict();
          alert($.ui);
          response( $.ui.autocomplete.filter(
              tags, extractLast( request.term ) ) );
      },
      focus: function() {
          // prevent value inserted on focus
          return false;
      },
      select: function( event, ui ) {
          var terms = split( this.value );
          // remove the current input
          terms.pop();
          // add the selected item
          terms.push( ui.item.value );
          // add placeholder to get the comma-and-space at the end
          terms.push( "" );
          this.value = terms.join( ", " );
          return false;
      }
  });
  </code></pre>
  
  <p>The error is coming from the line <code>response( $.ui.autocomplete.filter(</code> inside the source. For some reason <code>$( "textarea:[name='tags']" ).autocomplete</code> is perfectly fine and defined, but $.ui.autocomplete isn't.</p>
  
  <p>I have both jQuery and jQuery UI included above this script. What could be causing this? </p>
  
  <p>EDIT:</p>
  
  <p>I've noticed that if I put in <code>alert($.ui);</code> outside of the autocomplete function it displays <code>[Object object]</code>, but if I put the same alert inside the source attribute of the autocomplete, it is undefined. Doing the same thing with $ shows that $ is defined inside, but $.ui is not. I also have a datepicker on the page, and it's showing the same thing, $.ui isn't defined inside the plugin. Why would jQuery UI be undefined inside these plugins?</p>
  
  <p>EDIT 2:</p>
  
  <p>Putting <code>$.noConflict()</code> in the source attribute right above the response function gets it working just long enough for me to type in one tag, then it crashes the autocomplete, though the datepicker still works. I tried putting it in the create function so it would only execute once, but that just disables all other jQuery on the page.</p>
  
  <p>I'm not very experienced with jQuery or Javascript but it almost seems like the jQuery UI plugins are deleting the alias.</p>