Question

$('document').delegate('.seeMore a', "click", function() {
    var $allTabs = $(this).closest('.globalTabs').find('.allTabs');
    $allTabs.slideDown('slow'); 
});

The DOM elements are:

<div class="globalTabs">
    <ul>
        <li>
            <a>some link</a>
        </li>
        <li>
            <a>some link</a>
        </li>
        <li class="seeMore">
            <a>some link</a>
        </li>
    </ul>
    <div class="tabContent">
        some content
    </div>
    <div class="allTabs">
        mutliple links
    </div>
</div>

the above function is in an .each - so for each .globalTabs this function should run.

But it seems to not be finding the elements at all, even when there is only one on the page, the seeMore a doesn't have any events tied to it (using visual event to determine).

Thoughts?

(I should mention that bind works, but live does not).

Was it helpful?

Solution

There is no need in quotes for document in the first selector:

// v------v-------- 'document' should be an object, not a string
 $(document).delegate(".seeMore a", "click", function() { ... });
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top