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.
The code you have works, you can see a demo here. Make sure that your selector matches like you think it does, this is most likely the issue…
.delegate()itself handles this case.Usually this happens as a result of something like this, over-assigning the
selectedclass: