Hi,

I have the following code working in a rails 3 view, but it is
unfortunately not pure rails code!

<% @filter1 = "tr.show1,tr.show2" %>
<% @filter2 = "tr.show1" %>
<% @filter3 = "tr.show2" %>

<form>
  <p>
  <input type="checkbox" value=<%=@filter1%> onclick="$
(this).is(':checked') && $(this.value).addClass('hidden') || $
(this.value).removeClass('hidden');">Filter1<br/>
  <input type="checkbox" value=<%=@filter2%> onclick="$
(this).is(':checked') && $(this.value).addClass('hidden') || $
(this.value).removeClass('hidden');">Filter2<br/>
  <input type="checkbox" value=<%=@filter3%> onclick="$
(this).is(':checked') && $(this.value).addClass('hidden') || $
(this.value).removeClass('hidden');">Filter3<br/>
  </p>
</form>

<table border=1>
  <tr class="show1">
    <td>Hi</td>
    <td>How</td>
  </tr>
  <tr class="show2">
    <td>Are</td>
    <td>You</td>
  </tr>
</table>

With that code I can hide rows in my table by just checking the boxes
and show them by unchecking the boxes!

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!

I hope some can help me! The best would be to get a short example how
to do that.

Sebastian

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