Dynamically adding rows to an accessible HTML form
Most of this code is due to the fact that you're increasing the numbers in your attributes. I think that's a mistake. Your rows should all have identical name attributes, stored in an array (e.g. name="task[]").

The only problem would then be the identical IDs. Frankly, you shouldn't be using IDs in the first place. The only advantage of using IDs in this case is to associate the labels to the form fields (so that clicking the label focuses on the form field). This could easily be accomplished by wrapping the label around the form element.

So, to summarize, here are some points to consider:


Get rid of the IDs
Wrap the labels around the form elements to associate them with one another
Get rid of the numbers from the names
Use array like notation (e.g. name="task[]") for your names




Once you've incorporated all this, you can simply clone the row when needed.

HTML:

&lt;fieldset id="timesheet-rows"&gt;
    &lt;legend&gt;Add Entries&lt;/legend&gt;

    &lt;div class="timesheet-row"&gt;

        &lt;label&gt;Project:
            &lt;select name="project[]" required&gt;
                &lt;option value=""&gt;&lt;/option&gt;
            &lt;/select&gt;
        &lt;/label&gt;

        &lt;label&gt;Department:
            &lt;select name="department[]" required&gt;
                &lt;option value=""&gt;&lt;/option&gt;
            &lt;/select&gt;
        &lt;/label&gt;

        &lt;label&gt;Task: 
            &lt;select name="task[]" required&gt;
                &lt;option value=""&gt;&lt;/option&gt;
            &lt;/select&gt;
        &lt;/label&gt;

        &lt;label&gt;Hours:
            &lt;input type="number" step="0.25" name="hours[]" width="1" placeholder="2.0" required /&gt;
        &lt;/label&gt;

        &lt;label&gt;Comment:
            &lt;input type="text" name="comment[]" width="50" /&gt;
        &lt;/label&gt;

    &lt;/div&gt;

    &lt;input type="button" id="add-row" name="add-row" value="Add row" /&gt;
&lt;/fieldset&gt;​


Javascript:

jQuery(function($) {
    var $button = $('#add-row'),
        $row = $('.timesheet-row').clone();

    $button.click(function() {
        $row.clone().insertBefore( $button );
    });
});​


Here's the fiddle: http://jsfiddle.net/wd5y9/