Increase id with 1
<p>I want the following. When the user is clicking on the button, the id must me increase with 1. Now I uses a familiar function for unique id's for my rows and works correctly. Now I have used the same snippet of code for unique input fields, but this doesn't work. Also it's strange that the following code does his work correctly on the name attribute...</p>

<pre><code>    clone.find('#dsmeta_image_caption').prop('name', 'dsmeta_image_caption[' + row.length + ']'); // we now need to set the new ID for the row - ID's cannot be duplicated. This again will use the row.length
</code></pre>

<p>So what I want is to increase each field id with 1.</p>

<p>Code JS:</p>

<pre><code>function create_row_event(event) {
    // Declared variable
    var row = jQuery('tbody tr.row');
    var clone = row.last().clone(true);

    // Find the cloned fields and reset the values of it
    clone.find('input[type=text], text, textarea, select, input.upload_image').val(''); // Reset the values
    clone.find('.preview_image').attr('src', ''); // Reset the values


    row.parent('tbody.ui-sortable').append(clone); // Append the new row to the body
    clone.prop('id', 'repeatable-[' + row.length + ']'); // we now need to set the new ID for the row - ID's cannot be duplicated. This again will use the row.length
            clone.find('input#dsmeta_image_caption').prop('id', '[' + row.length + ']');


}
</code></pre>

<p>Hope someone can help me out!</p>

<p>Here you can see the code: <a href="http://jsfiddle.net/Caspert/ttgMc/7/" rel="nofollow">http://jsfiddle.net/Caspert/ttgMc/7/</a></p>
