>
>
> Now I want to do that in pure Rails 3 code with a check_box_tag, but I
> don't know where to put my jquery code. I already watched the Railcast
> episode about jquery, but that didn't helped me at all!
>
>
uff , your code is messy. ok here it goes. since the form is only to render
the check_boxes you can leave it as it is but add an id to it

<form id=>"filters">

and checkboxes

check_box_tag  'show1', 'show'
check_box_tag  'show2', 'show'
check_box_tag  'showall', 'show'


then in your application.js file (rails 3.0.x)

$("#filter input:checkbox").click(function(){
   class_to_show =  $(this).attr("id");
  switch(class_to_show){
      case 'show1':
         $(".show1").show();
         $(".show2").hide();
      break;
      case 'show2':
         $(".show1").hide();
         $(".show2").show();
      break;
      default
         $(".show1").show();
         $(".show2").show();
   }
});

aint that pretty?

-- 
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