 <p>You are simply over complicating things.</p> <p>This should do the job</p> <pre><code>$(function () { $('p.active').hide(); $('.mosaic-block').click(function () { var $this =$(this); $('.mosaic-block').removeClass('mosaic-block-highlighted'); $this.addClass('mosaic-block-highlighted'); $('p.active').hide(); // traverse to the closest `imgBlock` class and // find the p.active element and show it $this.closest('.imgBlock').find('p.active').show(); }); }); </code></pre> <p><strong><a href="http://jsfiddle.net/sushanth009/pQLhy/2/" rel="nofollow">Check Fiddle</a></strong></p>