I know this is really simple, but it always seems to stump me.
Say I have several divs that each have a certain link. How can I make sure that when a link is clicked that it will only change elements that are within it’s parent div and not the others?
Say you have this structure:
<div class="fun">
<a href="..."></a>
<p>Howdy!</p>
</div>
<div class="fun">
<a href="..."></a>
<p>Howdy!</p>
</div>
<div class="fun">
<a href="..."></a>
<p>Howdy!</p>
</div>
Then, if you want to manipulate the paragraph element within the same div as the link you clicked, you would use:
$(".fun>a").click(function(){
$(this).siblings("p").css('color','#ccc');
});
Is this what you meant?
P.S. - Example uses Jquery
Cheers.