for(var i=0; i<$("#courselist_show_<%= @courselist.id %>").nextAll().length; i++){
    var index = parseInt($($("#courselist_show_<%= @courselist.id %>").nextAll()[i]).children(":first").html());
    $($("#courselist_show_<%= @courselist.id %>").nextAll()[i]).children(":first").html(index - 1);
}
$("#courselist_show_<%= @courselist.id %>").remove();