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.
D9d1b31a337f46ac5e4dd56b55404f58?d=identicon&s=25 Dylan Markow (Guest)
on 2006-04-20 01: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.
4daf0b71d5d9a3882e583c0e72eaf5dc?d=identicon&s=25 Alan Francis (Guest)
on 2006-04-20 12: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.