How to clone element with new id?
<p>I have some elements on the page. Here is example of one element:</p>

<pre><code>&lt;div id="119" class="message"&gt;
&lt;div class="messageAuthor"&gt;iggy&lt;/div&gt;
&lt;div class="messageBody messageMessage"&gt;hello&lt;/div&gt;
&lt;div class="messageDate messageCreate_date"&gt;12:13&lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>I get from server new items and items which were updated in JSON. Here is example of using JSON response:</p>

<pre><code>$.each(ajaxResult.items, function(index) {
    for (var key in ajaxResult.items[index]) {
        if (ajaxResult.items[index].hasOwnProperty(key)) {
            if ($('.'+ajaxResult.controller + self.toUpperFirst(key)).length) {
                if ($('#'+ajaxResult.items[index].id).length) {
                    $('#'+ajaxResult.items[index].id).children('.'+ajaxResult.controller + self.toUpperFirst(key)).text(ajaxResult.items[index][key]);
                }
                else {
                    var prevIndex = parseInt(index) - 1;

                    $('#'+ajaxResult.items[prevIndex].id).after($('#'+ajaxResult.items[prevIndex].id).html());
                }

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

<p>I want to add new elements after existing elements. I don't know what the best way to do it. I need help.</p>
