Where to put JavaScript configuration functions?
<p>What is the general developer opinion on including javascript code on the file instead of including it on the script tag.</p>

<p>So we all agree that jquery needs to be included with a script file, like below:</p>

<pre><code> &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"
         type="text/javascript"&gt;&lt;/script&gt;
</code></pre>

<p>My question is, in order to get functions on a page that is not on all pages of a site. Do we include the functions like below in the same page or in a global include file like above called mysite.js.</p>

<pre><code>$(document).ready(function(){
$(".clickme").click(function(event){
  alert("Thanks for visiting!");
 });
});
</code></pre>

<p>ok. So the question is: if the code above is going to be called in every class="clickme"  on a specific pages, and you have the ability to call it either from an include separate file called mysite.js or in the content of the page. Which way will you go?</p>

<p><hr /></p>

<p>Arguments are: </p>

<ul>
<li><p>If you include it on the page you will only call it from those specific pages that the js functionality is needed.</p></li>
<li><p>Or you include it as a file, which the browser cached, but then jquery will have to spend x ms to know that that function is not trigger on a page without "clickme" class in it.</p></li>
</ul>

<p><hr /></p>

<p>EDIT 1: 
Ok. One point that I want to make sure people address is what is the effect of having the document.ready function called things that does not exist in the page, will that trigger any type of delay on the browser?  Is that a significant impact?</p>
