title: jQuery: Adding td element to a tr
body: <p>Using a <code>row</code> variable to get data dynamically and set the table row.</p>
  
  <pre><code>var row = '&lt;tr&gt;'+
        '&lt;td&gt;'+obj.Message+'&lt;/td&gt;'+
        '&lt;td&gt;'+obj.Error+'&lt;/td&gt;'+
        '&lt;td&gt;'+obj.Detail+'&lt;/td&gt;'+
        '&lt;/tr&gt;';
  </code></pre>
  
  <p>Based a value I tried to add another <code>&lt;td&gt;</code> to the row object but it didn't work.</p>
  
  <pre><code>if(obj.Type=='Error') {
    $(row).find('td:last').append('&lt;td&gt;'+ obj.ErrorCode+'&lt;/td&gt;');
  }
  $('table&gt; tbody:last').append(row);
  </code></pre>
  
  <p>First I tried to just append the <code>&lt;td&gt;</code> to row but that didn't work as well.</p>
  
  <pre><code>$(row).append('&lt;td&gt;'+ obj.ErrorCode+'&lt;/td&gt;');
  </code></pre>