I’m using a straight forward implementation of Ryan’s dynamic add/remove functionality from Recipe 13 of the book. It’s all working well, but I’d like to add a standard confirm delete dialogue, just like how Rails normally does it. I.e. when the user clicks the “remove” link, I want him to simply confirm that he actually wants to delete the item. Otherwise, it all happens too fast and isn’t very user friendly.
I tried implementing this by adding a call to the link_to_function line in the _task.html.erb file, but that didn’t work.
I tried these approaches:
<%= link_to_function “Remove”, “$(this).up(‘.task’).remove()”, :class => ‘delete’, :confirm => ‘Are you sure?’ %>
<%= link_to_function “Remove”, “$(this).up(‘.task’).remove()”, :confirm => ‘Are you sure?’ %>
Neither one works.
Anybody have a good solution? Thanks!