Copying children elements from one list item to another
<p>I have two list. An unordered list and a set of divs which are acting as a list. The unordered list has 4 list items and there are also 4 divs.</p>

<p>What I am trying to achieve is to copy the heading from each div and place it in each list item. In order words the heading of first div should correspond to that of the first list-item.</p>

<p>All i have been able to achieve thus far, is to loop through the divs and alert the heading which i want to copy as shown below but i am not sure how to proceed.</p>

<pre><code>&lt;div class="container"&gt;
    &lt;div class="nav-list"&gt;
        &lt;ul&gt;
            &lt;li&gt;1&lt;/li&gt;
            &lt;li&gt;2&lt;/li&gt;
            &lt;li&gt;3&lt;/li&gt;
            &lt;li&gt;4&lt;/li&gt;
        &lt;/ul&gt;
     &lt;/div&gt;
    &lt;div class="tab-list"&gt;
        &lt;div class="tab-item"&gt;
            &lt;h3&gt;To be copied&lt;/h3&gt;
        &lt;/div&gt;
        &lt;div class="tab-item"&gt;
            &lt;h3&gt;To be copied&lt;/h3&gt;
        &lt;/div&gt;
        &lt;div class="tab-item"&gt;
            &lt;h3&gt;To be copied&lt;/h3&gt;
        &lt;/div&gt;
        &lt;div class="tab-item"&gt;
            &lt;h3&gt;To be copied&lt;/h3&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


$('.tab-list .tab-item').each(function(index) {
    alert(index + ': ' + $(this).children('h3').text());
});
</code></pre>
