Forums » Ruby on Rails » How to implement check all/uncheck all option using Ruby on Rails
Give the check boxes a certain CSS class, e.g. right. Then add two link_to_function:


<%= link_to_function 'Check all', "$$('input.right').each(function(checkbox) { checkbox.checked = true; });" %>
<%= link_to_function 'Uncheck all', "$$('input.right').each(function(checkbox) { checkbox.checked = false; });" %>