title: Why is jQuery is not checking/unchecking checkbox
body: <p>When I run the following self-contained code, the checkbox gets checked and unchecked once but thereafter it doesn't even though the messages seem to imply the toggling.</p>
  
  <pre><code>&lt;html&gt;  
  &lt;head&gt;
  &lt;title&gt;dummy&lt;/title&gt;
  &lt;script src="http://code.jquery.com/jquery-1.10.2.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;input id="fc" type="checkbox" /&gt;
  &lt;script&gt;
  function f () {
    if (typeof $("#fc").attr("checked") !== 'undefined') {
      alert("checked, unchecking");
      $("#fc").removeAttr("checked");
    } else {
      alert("unchecked, checking");
      $("#fc").attr("checked", "checked");
    }
    setTimeout(f, 1000);
  }
  setTimeout(f, 1000);
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>