JQuery parents().eq(2) and .parent().parent() not behaving?
<p>Here is my code:</p>

<pre><code>function showNotification(title, message) {
    var newNotification = $('&lt;div&gt;&lt;/div&gt;');
    var newNotificationHeader = $('&lt;div&gt;' + title + '&lt;/div&gt;');
    var newNotificationCloser = $('&lt;div&gt;&lt;/div&gt;');
    newNotificationCloser.click(function(){
        closeNotification($(this).closest('notification'));
    });
    var newNotificationMessage = $('&lt;div&gt;' + message + '&lt;/div&gt;');

    newNotification.attr('class', 'notification');
    newNotification.css('opacity', 0);
    newNotificationHeader.attr('class', 'notificationHeader');
    newNotificationCloser.attr('class', 'notificationCloser');


    newNotificationMessage.attr('class', 'notificationMessage');

    newNotificationHeader.append(newNotificationCloser);
    newNotification.append(newNotificationHeader);
    newNotification.append(newNotificationMessage);

    $('body').append(newNotification);
    newNotification.animate({left: '10px', opacity:1}, 400).delay(15000).animate({top: '61px', opacity:0}, 500);

}

function closeNotification(notificationWindow) {
    notificationWindow.animate({top: '61px', opacity:0}, 500);
}
</code></pre>

<p>Basically I am trying to nest several divs and then append them to the body.</p>

<p>My closeNotification() function is expecting the main div with the class of "notification".  I can't use IDs because there may be more than one notification on the page at any given time.</p>

<pre><code>&lt;body&gt;
    &lt;div class="notification"&gt;
        &lt;div class="notificationHeader"&gt;
            &lt;div class="notificationCloser"&gt;
            &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="notificationMessage"&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/body&gt;
</code></pre>

<p>I have tried to use the following two methods in the notificationCloser's click code:</p>

<pre><code>closeNotification($(this).parent().parent());
</code></pre>

<p>and</p>

<pre><code>closeNotification($(this).parents().eq(1));
</code></pre>

<p>Oddly enough these don't seem to work but the following will hide the body:</p>

<pre><code>closeNotification($(this).parent().parent().parent());
</code></pre>

<p>and</p>

<pre><code>closeNotification($(this).parents().eq(2));
</code></pre>

<p>Any help on this would be appreciated.</p>
