Hi tetris,
You're almost there. Rather than event.stopPropagation(), try event.preventDefault() or return false.
--Karl _________________ Karl Swedberg www.englishrules.com www.learningjquery.com On Apr 13, 2008, at 3:41 AM, tetris wrote:
I have been trying to select the <a> tags in a <ul><li> config. with no succes: $(document).ready(function() { $('#sub-portfolio .button').click(function(event) { $('#sub-portfolio .button').removeClass('selected'); $(this).addClass('selected'); event.stopPropagation(); }); }); html part: <ul id="sub-portfolio"> <li class="button"><a href="">Print</a></li> <li class="button" id="web">Web</li> <li class="button">Video</li> </ul> my goal is that each time you click a <li> it gets the 'selected' class(so only one <li> has the 'selected' class at a time), the function works if i remove the <a href> part from the <li> but i need this part or i loose the hover class, so my problem is that im unable to reach the <a href> part with this selector: $('#sub- portfolio .button') any help would be appreciated