Topic: Adding rails.js ajax callbacks to dynamically added elements rails3.1

I have an ajax request that updates a table. Inside the table I have link_to remote actions. The problem I'm having is if I update the table via the ajax request all of the link_to remotes in the table no longer work. I'm guessing this is because these are now new elements and haven't been binded to the rails ajax callbacks like they would on page load. How would I re-add these callbacks on the link_to remotes inside the table once the table is regenerated?

Re: Adding rails.js ajax callbacks to dynamically added elements rails3.1

Err... actually figured out my problem about a minute after I wrote this.

I was using jquery's replaceWith function to update the table. However, if I use the .html to replace the data instead it will apply the callbacks automatically for me.