i have this situation:
<ul class="accept_friends">
<li>
<div class="center_image">test1</div>
<div>
<a href="" id="addfriend" class="gbutton gleft gadd" title="6">Add</a>
<a href="" id="denyfriend" class="gbutton gright gdelete" title="6">Deny</a>
</div>
</li>
<li>
<div class="center_image">test2</div>
<div>
<a href="" id="addfriend" class="gbutton gleft gadd" title="4">Add</a>
<a href="" id="denyfriend" class="gbutton gright gdelete" title="4">Deny</a>
</div>
</li>
</ul>
when i click on the #addfriend or ‘#denyfriend’ i would like to remove that li that contains those buttons.
$('#addfriend').on("click", function(){
//remove the current li
});
any ideas how to find that li?
thanks
Use closest. Also you can only have one element with a given id. You should be using classes for your links, not ids.