title: Problems Getting jQuery to Work in External js File
body: <p>I have just started messing with jQuery and have had luck getting it to work within actual aspx and html files, but I'm now trying to get it working in an external js file.</p>
  
  <p>In my html file in the head I have:</p>
  
  <pre><code> &lt;!--Declare jQuery files--&gt;
  &lt;script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5.1.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5.1.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5.1-vsdoc.js"&gt;&lt;/script&gt;
  
  &lt;!--Declare external java files--&gt;
  &lt;script type="text/javascript" src="javascript/SiteFunction.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>I have tried adding this to avoid multiple document ready instances, it hasn't effected anything either way, having in or not:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(document).ready(function() { });
  &lt;/script&gt;
  </code></pre>
  
  <p>In my external file I have (it is in an if statement and my function just literally skips over all the jQuery .append and .animate stuff as if it were not even there):</p>
  
  <pre><code>        $(document).ready(function() {
              $('&lt;p&gt;Test&lt;/p&gt;').append("#" + newPage);
          });
  
          jQuery(function($) {
              alert(newPage);
              $('&lt;p&gt;Test&lt;/p&gt;').appendTo(newPage);
  
              $(newPage).animate({ left: '0px' }, 2000, function() {
                  // Animation complete.
                  alert("animated newPage");
              });
  
              $(currentPage).animate({ right: '0px' }, 2000, function() {
                  // Animation complete.
              });
          });
  </code></pre>
  
  <p>The first jQuery append is just a simple test to see if I could do something simple.  This is all contained in an if statement.  I am not receiving any errors and the code is preceding through the first jQuery ready, going into the jQuery function, my alert(newPage) is working, but my alert("animated newPage") is not so I know that I am not even entering into any of the jQuery functions.</p>
  
  <p>If my terminology is incorrect, please forgive me, again I have just started working with Query over the past 3-4 days.</p>
  
  <p>My variables, newPage and currentPage are the id's of divs contained in the main html page.  I am accessing and manipulating them fine with javascript in the same external js file.</p>
  
  <p>I tried with the first jQuery .append to see if I needed to add the "#" before my div id to reference as a string.</p>
  
  <p>I've tried with the rest wrapping them in the jQuery(function($) {});.  Leaving them as just stand alone, which worked directly from my html file.</p>
  
  <p>Example of working code from html file.  Same setup in the head of the file</p>
  
  <pre><code>                       $(myContent).animate({
                          width: '0px'
                      }, mySpeed, function() {
                          // Animation complete.
                      });
  
                      $('#contentH4').animate({
                          width: myLeft
                      }, mySpeed, function() {
                          // Animation complete.
                      });
  </code></pre>
  
  <p>So, I'm at a complete loss! </p>