title: Observing change in radio button selection using Prototype JS
body: <p>I'm relatively new to Prototype JS (v1.7), and I'm stuck on something. I'm trying to detect when a change in the radio button selection occurs. Here's the code:</p>
  
  <p>Radio buttons:</p>
  
  <pre><code>&lt;input class="amounts" type="radio" name="amount" id="amount-1" value="1" /&gt;
  &lt;input class="amounts" type="radio" name="amount" id="amount-2" value="2" /&gt;
  &lt;input class="amounts" type="radio" name="amount" id="amount-3" value="3" /&gt;
  </code></pre>
  
  <p>Javascript:
  Here's a stab I took at it, which doesn't work:</p>
  
  <pre><code>Event.observe($$('amounts'), 'change', function(event) {
      alert('change detected');
  });
  </code></pre>
  
  <p>When the form loads, no radio buttons are checked. I'd like the Javascript to detect these events: </p>
  
  <ol>
  <li>A radio button is selected when none was previously selected  </li>
  <li>The radio button selection changes  </li>
  </ol>
  
  <p>Any help would be greatly appreciated. </p>