Add element to table by jquery
<p>I have one table with a row. And I want to add the column to the row with the possible condition of my script with jquery. This is my sample code :</p>

<pre><code>&lt;script type="text/javascript" language="javascript"&gt;
  function loadContent() {
    var $parent = $("#productlist").empty(); //empty div
    $parent.append('&lt;br /&gt;&lt;table id="myTable" cellpadding="0" cellspacing="0" width="100%" class="productlist" style="margin-left:4px; padding-top:2px;"&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;');
    if (k % 3 == 0 &amp;&amp; k == 0) {
        var $table = $parent.find("#myTable &gt; tbody");
        var htmlRow = [
                      '&lt;tr align="center"&gt;',
                      '&lt;td align="center" id="colunm-product"&gt;',
                       //some data
                       '&lt;/td&gt;'];
        $table.append(htmlRow.join(''));
    } else if ((k % 3 == 0) &amp;&amp; (k != 0)) {
       //add more &lt;td&gt;
    } else {
       //close &lt;/tr&gt;
    }
&lt;/script&gt;
</code></pre>

<p>Can I create <code>&lt;tr&gt;</code> and add more <code>&lt;td&gt;</code>, when in the possible condition , I will append <code>&lt;/tr&gt;</code>?</p>

<p>Any comment please?</p>
