im trying to hide the parent div that contains the clicked link:
<div class="user" id="request_1">
<div class="information">
<ul>
<li><a href="javascript:void(0)" class="approve_friends agree">Agree1</a></li>
</ul>
</div>
</div>
<div class="user" id="request_2">
<div class="information">
<ul>
<li><a href="javascript:void(0)" class="approve_friends agree">Agree3</a></li>
</ul>
</div>
</div>
<div class="user" id="request_3">
<div class="information">
<ul>
<li><a href="javascript:void(0)" class="approve_friends agree">Agree4</a></li>
</ul>
</div>
</div>
$('.agree').live("click", function(){
var currentId2 = $(this).parent("div:second").attr('id');
alert (currentId2);
$('#'.currentId).hide('slow');
});
so when i click on the Agree1, i want to hide the corespondent div with id request_1
here is the jsfiddle.
any ideas what i am doing wrong?
Thanks
I used parents instead of parent, and the line where you hide the element needed a + sign, not a dot.
http://jsfiddle.net/YThmH/1/