Unobtrusive Javascript for Rails is a Rails plugin that lets you attach behaviours to your page elements using pure Ruby with a little bit of CSS selector magic, in an unobtrusive manner, including patches to Rails' built-in AJAX/Javascript helpers to make them unobtrusive.

You can do something as simple as:

Code:
    <div id="my_funky_box">Click Me!</div>

    <% apply_behaviour "#my_funky_box:click" do |page|
        page.alert "You clicked me!"
      end %>
Or even simpler:

Code:
    <%= content_tag "div", "Click Me!", :onclick => "alert('Hello World!')" %>
All behaviours will be extracted to an external javascript file, generated at runtime, helping to ensure behaviour is separated from content and presentation.

More info:
http://www.lukeredpath.co.uk/index.p...-for-rails-02/

Subversion:
http://opensource.agileevolved.com/s...t/tags/rel-0.2

Plugin Documentation:
http://opensource.agileevolved.com/unobtrusivejs/