Ajax sortable_element refresh

Hi,

I have the following ajax example, with a list of counters, and two buttons for adding/removing elements. The list is sortable.

There are two things that I don't know how to do: . remove an elemet . when I add a new element to the list, that element doesn't become sortable with the rest of the list

Thanks, hugo

#### View <html>   <head>     <title>Ajax List Demo</title>     <%= javascript_include_tag :defaults %>   </head>   <body>     <%= form_remote_tag(:update => "list",                        :url => { :action => :add_item },                        :position => "bottom" ) %>

      <%= text_field_tag :newitem %>       <%= submit_tag "Add item" %>     <%= end_form_tag %>

  <%= form_remote_tag(:delete => "list",                        :url => { :action => :cyaitem }) %>

      <%= text_field_tag :cyaitem %>       <%= submit_tag "Remove item" %>     <%= end_form_tag %>

  <ul id="list">     <% 6.times do |i| -%>     <li id="item_<%= i+1 %>">I'm number <%= i+1 %></li>     <% end -%>   </ul>

  <%= sortable_element 'list', :complete => visual_effect(:highlight, 'list') %>

  </body> </html>

### Controller

def index end

def add_item   render_text "<li id=\"item_7" + "\">I'm number 7</li>" end