how to get value of a div in jQuery
<p>I have this sample code but why is messageA always null?</p>

<pre><code>var test = "&lt;div id='message2'&gt;My Message 2&lt;/div&gt;"

var $response1 = $('&lt;div/&gt;').html(test);
var messageA = $('#message1', $response1).html();
alert ('message: ' + messageA);
</code></pre>

<p>it should come back as 'My Message 2'</p>
