title: How to reach an id or class after we used jQuery's replaceWith function?
body: <p>Curently I'm developing a prpject with django, and one of my view fills a table via ajax call and replaceWith function. The strange thing is, my html source doesn't change however i can see all table contents from chrome's inspect argument thing. And when i want to get an id or class from the generated content, jQuery can't find anything.</p>
  
  <p>So am i using replaceWith in a wrong way ?  and how can i select elements from newly generated content ? </p>
  
  <p>Here is the code : </p>
  
  <p><strong>Jquery Part</strong></p>
  
  <pre><code>   $('#channel_selector').change(function(event)                                                                                                               
     {                                                                                                                                                           
         event.preventDefault();                                                                                                                                 
         var selected_channel = $('#channel_selector').val();                                                                                                    
         deneme(selected_channel);                                                                                                                               
     });                                                                                                                                                         
  
     function deneme(d){                                                                                                                                         
         $.ajax({                                                                                                                                                
               type:"POST",                                                                                                                                      
               url:"/wsp/proginfo/",                                                                                                                       
               data:d,                                                                                                                                           
               dataType:'text',                                                                                                                                  
               success: function(msg){                                                                                                                           
                 var entity_table = $(msg).find("#program_table tbody").html();                                                                                  
                 entity_table = "&lt;tbody&gt;" + entity_table + "&lt;/tbody&gt;";                                                                                           
                 $("#program_table tbody").replaceWith(entity_table);                                                                                            
               }                                                                                                                                                 
      });
  </code></pre>
  
  <p><strong>Generating The Content</strong></p>
  
  <pre><code>  {% for entity in entities %}                                                                                                                                           
      &lt;tr&gt;                                                                                                                                                               
         &lt;td&gt;                                                                                                                                                            
           &lt;input type="checkbox" name="entity_selection" /&gt;                                                                                                             
         &lt;/td&gt;                                                                                                                                                           
         &lt;td&gt;{{entity.pk}}&lt;/td&gt;                                                                                                                                          
         &lt;td&gt;&lt;input type="text" value="{{entity.get_name}}" /&gt;&lt;/td&gt;                                                                                                      
         &lt;td&gt;&lt;input type="text" value="{{entity.get_productionYear}}" /&gt;&lt;/td&gt;                                                                                            
         &lt;td&gt;&lt;input type="text" value="{{entity.get_director}}" /&gt;&lt;/td&gt;                                                                                                  
         &lt;td&gt;&lt;input type="text" value="{{entity.get_cast}}" /&gt;&lt;/td&gt;                                                                                                      
         &lt;td&gt;&lt;input type="text" vaue="blah"/&gt;&lt;/td&gt;                                                                                                                       
         &lt;td&gt;&lt;input type="text" value="{{entity.get_ProgramDetail}}"&gt;&lt;/td&gt;                                                                                               
         &lt;td&gt;                                                                                                                                                            
             &lt;input type="submit" class="testB" value="Yeni Bölüm"/&gt;                                                                                                     
         &lt;/td&gt;
  </code></pre>
  
  <p><strong>And I want to alert when i clicked the testB button</strong></p>
  
  <pre><code>   $('.testB').click(function(){                                                                                                                               
         alert("ok");                                                                                                                                            
     });     
  </code></pre>