title: Click event on elements of Dynamically created Table in JS
body: <p>I have a button on my page, and on click it displays a dynamically created table. This is happening in a JS file.
  Part of the table creation is as follows-</p>
  
  <pre><code>table_body = '&lt;table border="1"&gt;';
      table_body += '&lt;tr&gt;';
          table_body += '&lt;th&gt;';
          table_body += '';
          table_body += '&lt;/th&gt;';
          table_body += '&lt;th&gt;';
          table_body += 'Name';
          table_body += '&lt;/th&gt;';
          table_body += '&lt;th&gt;';
          table_body += 'Age';
          table_body += '&lt;/th&gt;';
      table_body += '&lt;/tr&gt;';
      for(var i=0;i&lt;number_of_rows;i++){
          table_body+='&lt;tr&gt;';
              table_body += '&lt;td&gt;';
              table_body += i+1;
              table_body += '&lt;/td&gt;';
              table_body += '&lt;td&gt;';
              table_body += name[i];
              table_body += '&lt;/td&gt;';
              table_body += '&lt;td&gt;';
              table_body += '&lt;a href="" id='+name[i]+'&gt;Age Action&lt;/a&gt;';
              table_body += '&lt;/td&gt;';
          table_body+='&lt;/tr&gt;';
      }
      table_body+='&lt;/table&gt;';
  document.getElementById("tableDiv").innerHTML = table_body;
  </code></pre>
  
  <p>I am using Joomla Seblod and I have a div called <strong>tableDiv</strong>, and I'm replacing that div on the page with my created table after button click.
  I'm not able to track clicks (and then do other stuff) on <strong>Age Action</strong> above, from the same JS file. On the same file I have-</p>
  
  <pre><code>jQuery("#55").click(newTestFunction); //I have a console.log in newTestFunction
  </code></pre>
  
  <p>id=55 in the first Age Action row. 
  Is it because it's being dynamically generated? I have added the id attribute that should be different for different rows of it, but when I click on any one of them, it's not logging the console message that I have on click.</p>
  
  <p>I also checked the page source and it does not show any of the elements of the table. How/where can I track any click on the  element? Any help will be appreciated.</p>