adding some more javascript to run ...

Hi,

I have a form where I'm adding multiple items. So I have an "Add New Item" link to the page. Here's how I define it in the controller's helper ...

        def add_item_link(name)                 link_to_function name do |page|

page.insert_html :bottom, :ec_line_items, :partial => "ec_line_item", :object => EcLineItem.new                 end         end

The link is invoked on the page like so:

<%= add_item_link "Add an item" %>

My question is, let's say I want an additional javascript function, "myFunc()" to run after the above HTML has been inserted. How do I modify the helper function above to execute "myFunc()" after it has done its thing?

Thanks, - Dave

Try this:

def add_item_link(name)   link_to_function name do |page|     page.insert_html :bottom, :ec_line_items, :partial => "ec_line_item", :object => EcLineItem.new     page << "myFunc();"   end end