I am adding some dom with ajax in a page where i am trying to excluding seleted result by .not() but its not working for me.
Here is a simple example:
HTML:
<div class="list-item">
<span class="item-title">Some title</span>
<span class="edit fr"><a href="Edit link">Edit</a></span>
<span class="trash fr"><a href="#trashit" rel="trash">Trash</a></span>
<span class="live fr active"><a href="#liveit" rel="publish">Live</a></span>
<span class="draft fr"><a href="#draftit" rel="draft">Draft</a></span>
</div>
jQuery:
jQuery('.list-item span a').not('.list-item span.edit a').live('click', function(){
//do stuff
});
Observation:
- If i remove the
.not()section of the code the selection is works fine withlive(). - If i use
.not()but replacelive()withclick()the code works.
But i need to run the .not() (exclude the .edit class) with the live(); (including dom with ajax)
Thanks in advance!
As per the
.live()docs:So, add the class exclusion to the selector: