Weird behavior when removing an element from a cloned element in loop
<p>I'm making an ajax application, which receives a list, making a <code>&lt;li&gt;</code> html using clone() and append it to <code>&lt;ul&gt;</code>.</p>

<pre><code>   $.each(arr, function(i) {
    var item = $('#template').clone(true);
        if(arr[i].isTypeA) {
            item.find('.TypeB').remove(); 
        } else {
            item.find('.TypeA').remove();
        }
    });
</code></pre>

<p>But appended items in <code>&lt;ul&gt;</code> have no element (.TypeA) after looping.</p>

<p>Does this problem comes from clone()? or from closure?</p>

<p>I'm searching the solution, but couldn't find yet.</p>
