Complex Selectors with jQuery Delegate

Posted by Keith Rousseau on Stack Overflow See other posts from Stack Overflow or by Keith Rousseau
Published on 2010-05-17T16:05:00Z Indexed on 2010/05/17 16:10 UTC
Read the original article Hit count: 287

Is there a restriction on the complexity of selectors that can be used with delegate in jQuery 1.4.2?

This works for me:

   $('.activeTabsList').delegate('.activeTabsListItem', 'click', 
function() { 
   alert('here'); 
});

This does not work:

    $('.activeTabsList').delegate('.activeTabsListItem:not(.selected)', 'click', 
function() { 
   alert('here'); 
});

As you can probably assume, there is only 1 item at a time that has the selected class. When I click the other tabs, my delegate handler is still not fired.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-selectors