I like the javascript_include_tag helper to keep the javascript out of
the view.

In one of my views I have a collection of radio buttons with class
"our_aircraft" and a text field with class "other_aircraft".  Then I
pull in some javascript:

    = javascript_include_tag 'aircraft_selection'

In public/javascripts/aircraft_selection.js I clear the text field
when a radio button is checked and clear the radio buttons when the
text field receives input:

$(document).ready(function () {
  $(".our_aircraft").change(function () {
    $(".other_aircraft").val("");
  });

  $(".other_aircraft").keyup(function () {
    if ($(this).val() > "") {
      $(".our_aircraft").removeAttr("checked");
    }
  });
});

Enjoy!
Bryan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to