I need to dynamically add more fields to a form and have the new fields inputs values change as well
<p><a href="http://jsfiddle.net/vegas/2gPfn/" rel="nofollow"><strong>I have a jsfiddle here</strong></a> of the script I'm using to dynamically add rows to a field but have a problem. </p>

<p>On my form I have the 1st row that I want to duplicate with the script. The row consists of 6 inputs named <code>job_date1</code>, <code>tech_name1</code>, <code>cost_code1</code>, <code>pay_rate1</code>, <code>total_hours1</code>, and <code>sub_total1</code>.</p>

<p>When the second row is created via the script I now need the new rows input names to be set by the script if possible to <code>job_date2</code>, <code>tech_name2</code>, <code>cost_code2</code> and so on and with each new row created I need the end digit to move up one. </p>

<p>Here is the code:</p>

<pre><code>function addRow(tableID) {
        var table = document.getElementById(tableID);
        var rowCount = table.rows.length;
        var row = table.insertRow(rowCount); 
        var colCount = table.rows[0].cells.length;

        for(var i=0; i&lt;colCount; i++) { 
            var newcell = row.insertCell(i);
            newcell.innerHTML = table.rows[0].cells[i].innerHTML;

            switch(newcell.childNodes[0].type) {
                case "text":
                        newcell.childNodes[0].value = "";
                        break;
                case "checkbox":
                        newcell.childNodes[0].checked = false;
                        break;
                case "select-one":
                        newcell.childNodes[0].selectedIndex = 0;
                        break;
            }
        }
}

function deleteRow(tableID) {
        try {
        var table = document.getElementById(tableID);
        var rowCount = table.rows.length;

        for(var i=0; i&lt;rowCount; i++) {
            var row = table.rows[i];
            var chkbox = row.cells[0].childNodes[0];
            if(null !== chkbox &amp;&amp; true === chkbox.checked) {
                if(rowCount &lt;= 1) {
                    alert("Cannot delete all the rows.");
                    break;
                }
                table.deleteRow(i);
                rowCount--;
                i--;
            } 
        }
        } 
        catch(e) {
            alert(e);
        }
}
</code></pre>
