title: Can't find element in DOM after loading it with ajax (want to bind jquery plug in to it)
body: <p>So I have 2 html pages. 1 that functions as container and 1 that functions as content.
  When I load the content page with a table I'm able to use drag and drop.</p>
  
  <p>But when I go to my container page and load the content page into a div with ajax, the drag and drop stops working. All other javascript functionalities inside the content page still work. How can I bind the jquery dnd plugin to the table loaded with ajax?</p>
  
  <p>I'm using drag &amp; drop with this as tutorial <a href="http://isocra.com/2008/02/table-drag-and-drop-jquery-plugin/" rel="nofollow noreferrer">http://isocra.com/2008/02/table-drag-and-drop-jquery-plugin/</a></p>
  
  <p>my code looks like this:</p>
  
  <pre><code>$(window).load(function()
  {   if(temp == 0)
      { 
          DP("eerste keer")
          load_table(); 
          temp = 1;
      }
  } );
  
  function load_table()
  {    
      DP('load_table');
      $.ajax({
              //async: false,
              type: "POST",
              url: "/diagnose_hoofdpagina/table_diagnose/" + DosierID, // &lt;== loads requested page
              success: function (data) {
                      $("#diagnoses_zelf").html(''); //&lt;== clears current content of div
                      $("#diagnoses_zelf").append(data).trigger('create'); // &lt;== appends requested page
                  },
              error: function(){
                  alert('error');
                } 
          }).done(function() {
          update_table(); 
          initialize_table();    // &lt;== calls jquery plug in
          });
  
      return false;   
  }
  
  
  function initialize_table() 
  {
      var tableid = $('#diagnoses_zelf table').attr('id'); //&lt; this finds the correct table thanks to Fábio Batista =&gt; this option worked, rest didn't
      alert(tableid);
      $(tableid).tableDnD({    
          onDrop: function(table, row) {
          alert(table + "     "  +  row);
  
          },
          onDragStart: function(table,row){
          var tette = $(row).index;
          alert(tette);
          },
          dragHandle: ".dragHandle"
      });     
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/9gAM6.png" alt="enter image description here"></p>
  
  <p>How is this possible and what can I do about it?
  Can anyone help me with this please.</p>
  
  <p>Very short:
  I want access to the ID of the table I load into my container page with ajax and use the jquery drag and drop plug in on it.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p><em>Findings:</em></p>
  
  <p>Somehow my table in the container page got renamed to <strong>pSqlaTable</strong> instead of the id I gave to it in the controller page which is.</p>
  
  <pre><code>&lt;table id="tableDiagnose" class="table table-hover"&gt;
  </code></pre>
  
  <p>Thats why the code couldn't find the table annymore Got fixed by this code thanks to Fábio Batista:</p>
  
  <pre><code>$('#diagnoses_zelf table').tableDnD( ... );
  </code></pre>
  
  <p>, but how can I use the dnd plugin now ?</p>
  
  <p><strong>It finds the table now, but I'm still not able to bind the dnd plugin to it, Am I able to bind a jquery plug in to ajax loaded tables ?</strong></p>
  
  <p><strong>EDIT</strong></p>
  
  <pre><code>//drag &amp; drop http://isocra.com/2008/02/table-drag-and-drop-jquery-plugin/
  function initialize_table() 
  {
      var tableid = $('#diagnoses_zelf table').attr('id');
      alert(tableid);
      $('#' + tableid).tableDnD({    
          onDrop: function(table, row) {
          alert(table + "     "  +  row);
  
          },
          onDragStart: function(table,row){
          alert('issemer?');
          },
          dragHandle: ".dragHandle"
      });    
  } 
  </code></pre>
  
  <p>This is the code i'm still stuck with. tableid is correct but the initialisation of the jquery isn't. I can't drag the drows in the table. Is my syntax wrong ?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p><strong>Could it be that I can't bind the jquery to the table because I dynamicaly generate the table on the other page with ZPT (or javascript) ?</strong></p>