title: Inline Javascript works but not when external
body: <p>I have this short Javascript code that I want to put in a external file. The reason being is because there will be many .htm pages that would use it. So instead of putting it all inline at every single file, I want to put it in an external file.</p>
  
  <p>But the thing is, it doesn't work. The script is basically a "back to top" button. It works flawlessly when I put the script in the <code>.htm</code> file. Another note by the way, I'm loading the <code>.htm</code> file in a <code>Div</code>, could that cause problems? Edit: The file is loaded through the <code>.load()</code> jQuery function.</p>
  
  <p>I have also tried putting the script inline in my <code>index.html</code> but it fails to work there too.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>$('.backtotopwrapper').click(function(){
    $('body,html').animate({scrollTop: "0px"},1500);
  });
  </code></pre>
  
  <p>Update: I have tested my other .js code and the ones that have nothing to do with the .htm file work. The code that is specific to the elements inside the .htm is the only one that doesn't work.</p>