title: How to convert strings into accessible properties in Jquery to make the functionality dynamic
body: <p>I would like to make my JavaScript function into dynamic and more flexible. </p>
  
  <p>Actually, I have a table which has set of rows and each row has set of columns. In that, some columns may contain id attribute and anchor tags and other columns may not. Find the below sample table.</p>
  
  <pre><code> &lt;table id="history-data"&gt;
   &lt;tr&gt;
   &lt;td id="264"&gt; &lt;a class="add-icon"&gt;&lt;img src="/includes/images/plusCircle.png"&gt;&lt;/a&gt;&lt;/td&gt;
   &lt;td class="tdata"&gt;10/09/2014&lt;/td&gt;
   &lt;td class="tdata"&gt;09:25 AM&lt;/td&gt;
   &lt;td class="historyData"&gt;&lt;a class="sess-invite-link"&gt;Invite&lt;/a&gt;&lt;/td&gt;           
  &lt;/tr&gt;
  
   &lt;tr&gt;
   &lt;td id="264"&gt; &lt;a class="add-icon"&gt;&lt;img src="/includes/images/plusCircle.png"&gt;&lt;/a&gt;&lt;/td&gt;
   &lt;td class="tdata"&gt;10/09/2014&lt;/td&gt;
   &lt;td class="tdata"&gt;09:25 AM&lt;/td&gt;
   &lt;td class="historyData"&gt;&lt;a class="sess-invite-link"&gt;Invite&lt;/a&gt;&lt;/td&gt;            
   &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Now I would like to loop through the table rows and get specific column properties. For example for first column, I need to get id and for second column get its inner text and for last column I need to get the anchor data. </p>
  
  <p>I generated the script to make it working well. But I would like to make it dynamic as, in future, may add two more columns and need to access the child elements inside the column. </p>
  
  <p>Here is my JavaScript function:</p>
  
  <pre><code>// Get the table row objects
  var tableRow = $('#history-data &gt; tbody  &gt; tr');
  
  // List out the properties that need to be accessed.
  var arr = ["attr('id')","html()","html()","find('a').html()"];
  
  // Loop through the rows and access the properties
  for(var r = 0; r &lt; tableRow.length; r++){
      $(tableRow[r]).children().each(function(index) {
          console.log(arr[index]);
          console.log($(this).arr[index]); // fuzzy area
      });     
  }
  </code></pre>
  
  <p>Is there any possibility in JQuery to convert the string into to accessible property ?</p>
  
  <p>Thanks in advance.</p>