In your click handler you do:
Code:
$(".hidden").css({"display":"block"});
Which targets *all* elements that have that class. If you only want to target the ones that fall inside the .link div you'd have to find the .link div, and then find the .hidden div within it.
Sounds hard, but thankfully jQuery makes this really easy for us. It's hard to completely convey all of this without a proper example, so I've commented this code to show you what's happening.
Code JavaScript:
//change the selector so you're targeting the <a> instead
$(".link a").click(function(e) { //using the event variable passed in to the handler
e.preventDefault(); //prevent default click event from happening on the link
// "this" inside of a jQuery event handler references the element that the event came from
// .closest() goes up the tree and finds the first matching item based on the selector you passed in
// .show() is jQuerys built in method to apply display:block (there is also .hide() and .toggle())
$(this).closest(".link").find(".hidden").show();
});
Hope this helps
Bookmarks