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
so:
# ========================  <div id = "this_ra">
  <% fields_for_research_area(research_areas) do |ra_form| %>  
    <p>
      <%= ra_form.collection_select(:research_area_id
                                  , ResearchArea.get_list
                                  , :id, :name
                                  , {:prompt => true}) 
      %>
      <% link_to_function ''Remove'',
"this.up().remove();" %>
    </p>  
  <% end %>
  </div>
# ========================
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?
Thanks!
-Roy
Roy Pardee
Research Analyst/Programmer
Group Health Center For Health Studies (Cancer Research Network)
(206) 287-2078
Google Talk: rpardee
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Pardee, Roy
2008-Jul-18  18:53 UTC
Re: link_to_function to remove a <div> in both IE and FF
Hrm--nevermind.  More playing led me to this:
  $(this).up().remove() 
Which works in both IE and FF.
TODO: Learn javascript... :P
Thanks!
-Roy
-----Original Message-----
From: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
[mailto:rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org] On Behalf Of
Pardee, Roy
Sent: Friday, July 18, 2008 11:48 AM
To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: [Rails] 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
so:
# ========================  <div id = "this_ra">
  <% fields_for_research_area(research_areas) do |ra_form| %>  
    <p>
      <%= ra_form.collection_select(:research_area_id
                                  , ResearchArea.get_list
                                  , :id, :name
                                  , {:prompt => true}) 
      %>
      <% link_to_function ''Remove'',
"this.up().remove();" %>
    </p>
  <% end %>
  </div>
# ========================
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?
Thanks!
-Roy
Roy Pardee
Research Analyst/Programmer
Group Health Center For Health Studies (Cancer Research Network)
(206) 287-2078
Google Talk: rpardee
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---