Note that is() doesn't accept complex selectors (yet). The reason of your problems is probably this. Event delegation is surely the best approach, if you can live with its difficulties.
-- Ariel Flesler http://flesler.blogspot.com On Aug 26, 2:31 pm, hubbs <[EMAIL PROTECTED]> wrote: > I am working to replace all of my uses of livequery with event > delegation (is this even a good idea?) and have a few questions. > > I have a simple script that will add a "selected" class to a link when > it is clicked. It does work using event delegation, but it seems that > it is not limiting it to anchor tags, but will also add the "selected" > class to any spans that are inside my anchor. This seems strange, and > is not what I want, is something wrong with the following code? > > $('body').click(function(event) { > var $target = $(event.target); > if ($target.is('.scroll a')) { > $("a.selected").removeClass("selected"); > $(event.target).addClass("selected"); > } > });