.remove is not fired up in the next loop

.remove is not fired up in the next loop

Hi,

This actually a loop. but the .remove() is seems not working after the next loop. The code is :

  1. $( "#name1" ).remove();
  2.  
  3.  $( "#afterthis" ).append('<div id="name1"></div>');
  4.  $( "#name1" ).after( '<div class="sched-left-col" style="color:#000; font-size:2em; font-family: "Orbitron", sans-serif; padding:0 0.3em;">'+ obj.sched_on1 +'</div><div class="sched-content"><div style="font-size:3em;  padding-left:1em; color:#FFF; ">'+ obj.student1 +'</div></div><div class="clear"></div>' );
  5.  $(".sched-wrap").toggleClass('fadeIn fadeIn');