Selecting a div in jQuery & appending to the DOM
<pre><code>        var activeMsg=[];       // Active Users
        var noactiveMsg=[];     // Non-Active Users with a Pending Message
        var noactiveNomsg=[];       // Non-Active Users without a Pending Message

        $('div.chatmember').each(function() {
            currentMember=$(this);

            if($(this).children().children('div').hasClass('chatactivestatus_online')) {
                alert('online');
                activeMsg.push(currentMember);
            }
            if($(this).children().children('div').hasClass('chatactivestatus_offline')) {
                alert('offline');
                noactiveMsg.push(currentMember);
            }               
        });

        $.each(noactiveMsg, function(i, e){
             $('#chatCenterMembers').append(e.html());
         })
</code></pre>

<p>The above code is quering DOM structure that looks like this:</p>

<pre><code> &lt;div id="chatCenterMembers"&gt;
   &lt;div class="chatmember"&gt;
      &lt;a class="ststusTitle"&gt;
         &lt;div class="chatactivestatus_online"&gt;&lt;/div&gt;
</code></pre>

<p>it all works except for <code>currentMember=$(this);</code>
I believe this should hold <code>&lt;div class="chatmember"&gt;</code></p>

<p>when I do the append at the end of the code above it doesn't add <code>&lt;div class="chatmember"&gt;</code> back into the dom. It adds its children elements only.</p>
