Simple jQuery question
<pre><code>&lt;body&gt;
&lt;script type="text/javascript"&gt;
$('#red').click(function(){
    $('#write').text('red');
});

&lt;/script&gt;
&lt;form id="formId" name="formName" method="post"&gt;
  &lt;table&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;div class="clickDiv red" id="red"&gt;mmmmmmm&lt;/div&gt;&lt;/td&gt;
      &lt;td&gt;&lt;div class="clickDiv green"&gt;&lt;/div&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  &lt;div id="write"&gt;&lt;/div&gt;
  &lt;input type="radio" name="satir1" value="red" /&gt;
  &lt;input type="radio" name="satir1" value="green" /&gt;
&lt;/form&gt;
&lt;/body&gt;
</code></pre>

<p>This doesn't work.</p>

<pre><code>&lt;body&gt;
&lt;form id="formId" name="formName" method="post"&gt;
  &lt;table&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;div class="clickDiv red" id="red"&gt;mmmmmmm&lt;/div&gt;&lt;/td&gt;
      &lt;td&gt;&lt;div class="clickDiv green"&gt;&lt;/div&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  &lt;div id="write"&gt;&lt;/div&gt;
  &lt;input type="radio" name="satir1" value="red" /&gt;
  &lt;input type="radio" name="satir1" value="green" /&gt;
&lt;/form&gt;

&lt;script type="text/javascript"&gt;
$('#red').click(function(){
    $('#write').text('red');
});
&lt;/script&gt;
&lt;/body&gt;
</code></pre>

<p>This works. Why? How can I use script part in the header?</p>
