content appended with jquery is not part of the DOM
<p>I have an empty div <code>&lt;div id="content"&gt;&lt;/div&gt;</code> to which I add content via jquery append.</p>

<pre><code>$('#content').append('&lt;div class="sub"&gt;sub1&lt;/div&gt;');
$('#content').append('&lt;div class="sub"&gt;sub2&lt;/div&gt;');
$('#content').append('&lt;div class="sub"&gt;sub3&lt;/div&gt;');
</code></pre>

<p>When I click a button I want to run a jquery that reads the content of each sub, but I get nothing, I think because the div elements were added via javascript, so they're not really on the page. </p>

<pre><code>$('.sub').each(function(){
  alert($(this).text());
} 
</code></pre>

<p>How can I still operate on html added via javascript? </p>
