You can use .parent(), then .siblings(), for example:
$(this).parent().siblings('.inner').toggle();
But if you can make it unobtrusive, which would be a little more convenient, for example, give your link a class, for example:
<a href="#" class="toggler">hide</a>
Then you can bind this class (all its instances), for example:
$(function() {
$(".toggler").click(function() {
$(this).parent().siblings('.inner').toggle();
});
});
source
share