title: Click radio button automatically - greasemonkey
body: <p>I have 3 radio buttons and need to choose one (BAT) when the page loads.  Here is the HTML in question.</p>
  
  <pre><code>&lt;td valign="center"&gt;
       &lt;input id="T1" name="ZZ" type="radio" value="CAT"/&gt; &lt;label for="T1"&gt; cat &lt;/label&gt;&lt;br/&gt;
       &lt;input id="T2" name="ZZ" type="radio" value="DOG"/&gt; &lt;label for="T2"&gt; dog &lt;/label&gt;&lt;br/&gt;
       &lt;input id="T3" name="ZZ" type="radio" value="BAT"/&gt; &lt;label for="T3"&gt; bat &lt;/label&gt;&lt;br/&gt;
  &lt;/td&gt;
  </code></pre>
  
  <p>Here is the code that I'm using.</p>
  
  <pre><code>var elements = document.getElementsByTagName("input");
  for (i = 0; i &lt; elements.length; i++) {
      if (elements[i].value == "BAT") {
          elements[i].click();
      }
  }
  </code></pre>
  
  <p>Can anybody spot what I'm doing wrong? The radio button is never selected unfortunately.</p>