Link_to_function to remove a <div> in both IE and FF

Hey All,

I’ve got a partial _research_areas.html.erb, which has a
link_to_function call for removing the div defined by the partial, like


<% fields_for_research_area(research_areas) do |ra_form| %>

<%= ra_form.collection_select(:research_area_id , ResearchArea.get_list , :id, :name , {:prompt => true}) %> <% link_to_function 'Remove', "this.up().remove();" %>

<% end %>
# =========================

That works just fine in FF, but in IE nothing seems to happen (apart
from the page scrolling up to the top). The ticklish thing here is that
there can be any number of these divs on the page, all of which have the
same id. (These get added on the client w/another ltf call that renders
the partial into the page.) The above removes the correct div in FF,
but other things I’ve tried that do effect a remove in IE just remove
the first one.

I’ve played around w/trying to give each div a unique id, but haven’t
come up w/a good solution for accomplishing that, and the above works so
well in FF, I was hoping there might be some magic javascript out there
that would do the trick in both browsers. Is there?



Roy P.
Research Analyst/Programmer
Group Health Center For Health Studies (Cancer Research Network)
(206) 287-2078
Google Talk: rpardee

Hrm–nevermind. More playing led me to this:


Which works in both IE and FF.

TODO: Learn javascript… :stuck_out_tongue: