I'm using css to hide content that I want to reveal when a person clicks a link. There are multiple instances on the page.
I've set up an example but currently clicking any of the links reveals all of the content.
http://jsfiddle.net/paulyabsley/rHD43/
Thanks
Use .siblings()
to find an element with the class details
that is a sibling of the link's parent element.
$('.item h3 a').click(function () {
$(this).parent().siblings(".details").toggleClass("display");
});
DEMO
You could go up to the root element and search for the details.
$(this).parent().parent().find('.details').toggleClass("display");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With