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