unable to get dynamically created table on click of a static link
<p>I am trying to get the id of the table that is dynamically created. Data i am getting from json object. My question is related to accessing the dynamically created table when an static anchor is clicked. this anchor tag is not in the dynamically created table it is out side the table in the same page. anchor tag is not dynamic.</p>

<p>I don't understand the scope of dynamically generated table id 'resTable' when available only at one place. Appreciate if someone could explain what i am missing here.</p>

<p>thanks in advance. </p>

<p>My place holder div tag is like below. </p>



<pre><code>     $(document).ready(function() { 

              tableStr += "&lt;div class=\"test-table\"&gt;";   
              tableStr += "&lt;table id=\"resTable\"&gt;";    
              tableStr += "&lt;thead&gt;&lt;tr&gt;";

              $.each(parsedArray.data[0], function(key, value){       
                tableStr += '&lt;th scope="col"&gt;' + key + '&lt;/th&gt;';  
              });           

             tableStr += '&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;'; 
             for (var i in parsedArray.data) { 
                  if(i&lt;parsedArray.data.length){
                     var row = 0;
                     tableStr += '&lt;tr id=\"row'+i+'\"&gt;';             
                     $.each(parsedArray.data[i], function(key, value){         
                     tableStr += '&lt;td&gt;' + value + '&lt;/td&gt;';
                     tableStr += '&lt;/tr&gt;';  
                     row++;  
                    }
                   }   
               }
               tableStr += '&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;'; 
               var ele = document.getElementById('tableDiv');
               ele.innerHTML = tableStr;  
               alert("html():"+$('#resTable').html());
               //able to access here as soon as table dynamically created    


               $('#recordAnchor).click (function() {
                   alert("html():"+$('#resTable').html());
                   //NOT ABLE TO ACCESS 'resTable' that is dynamically generated under 
                   //DiV id 'table Div'                       
               }                   
       }

       //Unable to access from the below function. this function is called onClick of
       //a button 
       &lt;input type="button" name="nextRecord" onclick="getRecord()"/&gt;
       function getRecord(){
            alert("html():"+$('#resTable').html());
            //NOT ABLE TO ACCESS 'resTable' that is dynamically generated under 
                   //DiV id 'table Div' 
       }
</code></pre>

<p>My Html is like below </p>

<pre><code>             &lt;div class="bd"&gt;       
    &lt;br&gt;        
       &lt;div class="uwidth"&gt;
                                                 &lt;div id="tableDiv"&gt;&lt;/div&gt;
    &lt;/div&gt;      
    &lt;br&gt;
    &lt;div class="buttonPadding"&gt; 
                    &lt;input id="nextRecordButton" name="nextRecordButton" onclick="getRecord()" type="button" value="Next"/&gt;         
    &lt;/div&gt;  
               &lt;div id="recordAnchor"&gt;
                    &lt;a href="#" title="[Action] [Unique ID]"&gt;Record View&lt;/a&gt;
                &lt;/div&gt;  

&lt;/div&gt;
</code></pre>
