Forum: Ruby on Rails RJS replace_html auto-closing tags

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Dylan M. (Guest)
on 2006-04-20 03:44
(Received via mailing list)
I'm using the following RJS template to spit out a div containing a
list of projects:

page.replace_html 'results', '<div>'
@projects.each do |p|
   page.insert_html :bottom, 'results', p.name + "<br/>"
end
page.insert_html :bottom, 'searchresults', '</div>'
page.show 'results'

However, it seems that my first like to insert the <div> tag
automatically sticks a </div> closing tag in as well. Is there any
way to avoid this, as I'd like the content from the loop to be
inserted into this div.
Alan F. (Guest)
on 2006-04-20 14:19
> However, it seems that my first like to insert the <div> tag
> automatically sticks a </div> closing tag in as well. Is there any
> way to avoid this, as I'd like the content from the loop to be
> inserted into this div.

How about:
> page.replace_html 'results', '<div id="projectresults">'
> @projects.each do |p|
>    page.insert_html :bottom, 'projectsresults', p.name + "<br/>"
> end
> page.show 'results'
This topic is locked and can not be replied to.