prototype.js insert issue

Hi,

I am trying to use the following lines in my RJS and have a problem

page.insert_html :bottom,:list,"<ul>" #some conditions checks page.insert_html :bottom,:list,"<li>Hello item</li>" #some more code to add <li>s page.insert_html :bottom,:list,"</ul>"

The problem I am having is the first line <<page.insert_html :bottom,:list,"<ul>">> automatically closes <ul> if I see with firebug the output is

<ul></ul> <li>Hello item</li> </ul> Which is wrong

Using prototype how do I only insert a start tag <ul>?

Thanks, Sudhindra

Hi,

I am trying to use the following lines in my RJS and have a problem

page.insert_html :bottom,:list,"<ul>" #some conditions checks page.insert_html :bottom,:list,"<li>Hello item</li>" #some more code to add <li>s page.insert_html :bottom,:list,"</ul>"

The problem I am having is the first line <<page.insert_html :bottom,:list,"<ul>">> automatically closes <ul> if I see with firebug the output is

<ul></ul> <li>Hello item</li> </ul> Which is wrong

Using prototype how do I only insert a start tag <ul>?

looks like either prototype or the browser is fixing your html (as inserting just <ul> would be invalid). Your best bet is to build up all you want to insert and insert it in one go.

Fred

Sudhi Kulkarni wrote:

Hi,

I am trying to use the following lines in my RJS and have a problem

page.insert_html :bottom,:list,"<ul>" #some conditions checks page.insert_html :bottom,:list,"<li>Hello item</li>" #some more code to add <li>s page.insert_html :bottom,:list,"</ul>"

Hi, Why don't you try using jquery.js. Works great with rails too and is simpler than prototype.js.

Reference - http://jimneath.org/2008/06/18/using-jquery-with-ruby-on-rails/

Thanks, Manasi