On Apr 12, 11:22 am, ES <[email protected]> wrote:
>
>          <%= f.hidden_field :_destroy %>
>
>        <tr><td><%= link_to_function "remove", "remove_fields(this)"
> %></td></tr>
>
> </p>
>
> and in the appliction.js file I have:
>
> function remove_fields(link) {
>
>   $(link).previous("input[type=hidden]").value = "1";
>   $(link).up(".treatmentfields").hide();
>

Looks like because the hidden field and the link don't have the same
parent - the previous function finds you the previous sibling element
(matching the selector if specified)

Fred

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