Possible Duplicate:
jQuery onclick hide its parent element
I want to hide <li>
when someone click on its child <a>
. I used following jQuery code to perform the action but it is not working. Because if someone clicking on <a>
that is twitter button it first calling class "twitter-follow-button". And it is not going for the jQuery action.
jQuery Used:
$(document).ready(function(e) {
$('.twitter-follow-button').click(function() {
$(this).parent().hide();
});
});
HTML Used:
<ul>
<li>
<div>Something</div>
<p>Something</p>
<a href="https://twitter.com/'.$uname.'" class="twitter-follow-button">Follow </a>
</li>
<li>
<div>Something</div>
<p>Something</p>
<a href="https://twitter.com/'.$uname.'" class="twitter-follow-button">Follow</a>
</li>
</ul>