Add i++ for each new row that will created by the button
<p>I try to make some repeatable fields with PHP and Javascript. This works fine, but after saving the post (creating an plugin for WordPress) the cloned row will override the latest one. This is because I don't use unique id's for each row.</p>

<p>I want to add an 'id' attribute with javascript and I want for each row that is created with the id 1 increase. I had already done something similar with PHP, but found out that this is not what I wanted and I am better out with javascript, I think, because when I clone the field with the "add new" button the amount doesn't increase with +1;</p>

<p>Here is the php code that I had used:</p>

<pre><code>$count = 2;
for ($i = 0; $i &lt; $count; $i++) {

    // Begin a table row
    echo '&lt;tr class="row" id="' . '['.$i.']' . '-repeatable"&gt;';
    echo '&lt;td class="order"&gt;' . '['.$i.']' . '&lt;/td&gt;';

            // Do cool stuff inside the row

    echo '&lt;td class="remove"&gt;&lt;a class="repeatable-remove button" href="#"&gt;-&lt;/a&gt;&lt;/td&gt;';
    echo '&lt;/tr&gt;'; // End .row

} // End for loop

&lt;a href"#" class="button"&gt;Add new row&lt;/a&gt;
</code></pre>

<p>JS code for the repeatable fields:</p>

<pre><code>// Add repeatable row
jQuery('.repeatable-add').click(function() {
    // Clone row
    var row = jQuery(this).closest('.ui-sortable').find('tbody tr.row:last-child');
    var clone = row.clone();

    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.after(clone);

    //
    return false;
});
</code></pre>

<p>I think I have to do something like this snippet of line:</p>

<pre><code>clone.find('tr.row').attr('id', 'repeatable-' + addInteger);
</code></pre>

<p>But how do I increase with +1 inside Jquery/Javascript, like my example in PHP?</p>
