On Feb 13, 2008 2:10 PM, Matthew Marksbury <[EMAIL PROTECTED]> wrote:

>
> My HTML:
> ------------------------------
> <form id="someForm">
>      <input type="radio" id="myRadio_1" name="myRadio" />
>      <label for="myRadio_1">Radio 1</label>
>
>      <input type="radio" id="myRadio_2" name="myRadio" />
>      <label for="myRadio_2">Radio 1</label>
>
>      <input type="radio" id="myRadio_3" name="myRadio" />
>      <label for="myRadio_3">Radio 1</label>
> </form>
>
> My Javascript:
> ---------------------------------
> Event.observe('myRadio_3', 'click', function() {alert('some logic goes
> here');});


if you want to attach the observer to each one of the radio buttons,
one way is to get a list of them using $$(), or in 1.6 select(); something
like this,

$('someForm').select(input[type="radio"]).each(function(curInput) {
Event.observe(curInput, 'click', function() {alert('some logic goes
here');});
});

-nathan

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to