jQuery Function placement
<p>Ok, so I recently started learning jQuery, but I'm having trouble with a little animation program I got off of the jQuery website.
So here is the problem. This program works:</p>

<pre><code>&lt;HTML&gt;
&lt;HEAD&gt;
&lt;script type="text/javascript" src="javascript/jQuery-1.7.1.min.js"&gt;&lt;/script&gt;

&lt;STYLE type="text/css"&gt;

#content {
    background-color:#6688ff;
    position:absolute;
    width:100px;
    height:100px;
    padding:3px;
    margin-top:5px;
    left: 100px;
}
&lt;/STYLE&gt;
&lt;/HEAD&gt;
&lt;BODY&gt;
&lt;input type="button" id="left" value="Left"/&gt;
&lt;input type="button" id="right" value="Right"/&gt;
&lt;div id="content"&gt;Move&lt;/div&gt;
&lt;script type="text/javascript"&gt;
$("#right").click(function() {
    $("#content").animate(
            {"left": "+=50px"},
            "slow");
});
$("#left").click(function() {
    $("#content").animate(
                {"left": "-=50px"},
            "slow");
});
&lt;/script&gt;

&lt;/BODY&gt;
&lt;/HTML&gt;
</code></pre>

<p>But this program doesn't:</p>

<pre><code>&lt;HTML&gt;
&lt;HEAD&gt;
&lt;script type="text/javascript" src="javascript/jQuery-1.7.1.min.js"&gt;&lt;/script&gt;

&lt;script type="text/javascript"&gt;
$("#right").click(function() {
    $("#content").animate(
            {"left": "+=50px"},
            "slow");
});
$("#left").click(function() {
    $("#content").animate(
                {"left": "-=50px"},
            "slow");
});
&lt;/script&gt;

&lt;STYLE type="text/css"&gt;

#content {
    background-color:#6688ff;
    position:absolute;
    width:100px;
    height:100px;
    padding:3px;
    margin-top:5px;
    left: 100px;
}
&lt;/STYLE&gt;
&lt;/HEAD&gt;
&lt;BODY&gt;
&lt;input type="button" id="left" value="Left"/&gt;
&lt;input type="button" id="right" value="Right"/&gt;
&lt;div id="content"&gt;Move&lt;/div&gt;


&lt;/BODY&gt;
&lt;/HTML&gt;
</code></pre>

<p>The only difference between the two programs is where I put the javscript, so could anyone explain me why that makes a difference? Thanks, cause that is confusing me.</p>
