Cloning divs and replacing id's
<p>Hoping this isnt a repeat question as I could not find an answer.</p>

<p>I have a div that I need cloned.</p>

<pre><code>&lt;div class="phoneBookEntriesContainer"&gt;
    content here
&lt;/div&gt;
</code></pre>

<p>I have to add an ID afterwards...dont ask :P.</p>

<pre><code>&lt;script type="text/javascript"&gt;
var i = 1;
$(".phoneBookEntriesContainer").attr("id","phoneBookEntries" + i);
var doSomething = function(){

    $(".phoneBookEntriesContainer").attr("id","phoneBookEntries" + i);
    $("#phoneBookEntries" + i).clone().insertAfter("#phoneBookEntries" + i);

    i ++;
};
&lt;/script&gt;
</code></pre>

<p>The code above kinda works, but instead of giving my divs unique id's, it replaces all of them with the same id.</p>

<p>So at the start I would have one <code>#phoneBookEntries1</code> div, after clicking the button to run the function I have two <code>#phoneBookEntries2</code> divs etc etc.</p>
