title: jquery: Call function by name on select change
body: <p>I'm trying to call a function by name <code>.onchange</code> of a select but nothing happens. When the function is describled after the attribute, it works.</p>
  
  <p><strong>THIS DOESN'T WORK</strong></p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;select id="numb"&gt;
    &lt;option value="1"&gt;1&lt;/option&gt;
    &lt;option value="2"&gt;2&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>SCRIPT:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $('#numb').change(testMessage);
  &lt;/script&gt;
  
  &lt;script type="text/javascript"&gt;
      function testMessage(){
          alert('Hello');
      }
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>THIS WORKS</strong></p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;select id="numb"&gt;
    &lt;option value="1"&gt;1&lt;/option&gt;
    &lt;option value="2"&gt;2&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>SCRIPT:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $('#numb').change(function(){
        alert('Hello')
      });
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Ok, for all those who said me to include the function on the same script. This is not possible because the <code>testMessage()</code> function is in an external <code>.js</code> script included on the <code>&lt;head&gt;</code> of the HTML.</p>