Take the 2-minute tour ×

I have the following line of code:

<li id="1" class=" ">
<a href="">Parking Lot</a>
<span id="1" class="list-edit">edit</span>

I then have two binds:

$("#lists li").click(function(){.......


The problem I'm having is I need the LI to contain the EDIT span because of CSS styling reasons, I have a big blue background. But this is preventing me from binding the EDIT btn. Is there a way to get these two to play nice?


share|improve this question

1 Answer 1

up vote 1 down vote accepted

You can use event.stopPropagation to prevent the click handler attached to the parent LI from firing when the edit span is clicked (if that's what you mean):

    // do stuff
share|improve this answer
Awesome - I love learning something new - thank you –  AnApprentice May 22 '10 at 21:38
Turns out this doesn't work... It's still catching both of the binds. –  AnApprentice May 23 '10 at 5:00
@nobosh - are you passing the event object through the callback? i.e. $(".list-edit").click(function(e){ –  karim79 May 23 '10 at 8:20

Your Answer


