title: setTimeout does not wait for specified number of milliseconds
body: <p>I would like to have a form triggering submit after a few seconds of inactivity (using the <code>onKeyup</code> event).</p>
  
  <p>My code is as follows:</p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
          &lt;title&gt;Title&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;form id="getJSONForm"&gt;
              &lt;textarea rows="1" cols="10" onKeyUp="onKeyUp()"&gt;&lt;/textarea&gt;
              &lt;input type="submit" value="Submit" id="getJSON" /&gt;
          &lt;/form&gt;
  
          &lt;div id="result"  class="functions"&gt;&lt;/div&gt;
  
          &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"&gt;&lt;/script&gt;
          &lt;script type="text/javascript"&gt;
              $.ajaxSetup ({
                  cache: false
              });
  
              var timer;
  
              function onKeyUp() {
                  stoper();
                  timer = setTimeout ( $("#getJSONForm").submit(), 10000 ); 
              }
  
              function stoper() {
                  clearTimeout(timer);
              }
  
              $("#getJSONForm").submit(function(){
                      $("#result").html("hello");
                      return false;
              });
          &lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>But... the forms gets submitted at every <code>onKeyUp</code> event it seems. It does not wait for the timer to reach the specified 10,000 milliseconds.
  Is there a way to fix this?</p>