I'm using the below code to highlight the page name/gallery shown when the corresponding link is clicked on. My challenge is that regardless of what link I click, only the very first link(page_id=24/Haagen-Dazs) is highlighted. Any ideas what's causing the issue?
Thanks.
CSS
.active {
border: 1px solid #ff893b;
}
HTML/PHP/JAVA `
<p>
<a href="?page_id=24" <?php if ($page_id=='24'){echo 'class="active"';} ?>> Häagen Dazs</a><br/>
<a href="?page_id=26" <?php if ($page_id=='26'){echo 'class="active"';} ?>> Hugo Boss Rodeo Drive</a><br/>
<a href="?page_id=28" <?php if ($page_id=='28'){echo 'class="active"';} ?>> Ford</a><br/>
<a href="?page_id=30" <?php if ($page_id=='30'){echo 'class="active"';} ?>> MOCA Contemporaries</a><br/>
<a href="?page_id=32" <?php if ($page_id=='32'){echo 'class="active"';} ?>> XBOX 360 Halo 3 Sneak Preview</a><br/>
<a href="?page_id=34" <?php if ($page_id=='34'){echo 'class="active"';} ?>> Saddlerock Smith & Basso Weddings</a><br/>
<a href="?page_id=36" <?php if ($page_id=='36'){echo 'class="active"';} ?>> Christie's</a><br/>
<a href="?page_id=42" <?php if ($page_id=='42'){echo 'class="active"';} ?>> Instyle Magazine + Ming by Mango</a>
</p>
<script type="text/javascript">
$(document).ready(function(){
$('a').click(function(){
$('a').removeClass('active');
$(this).addClass('active');
});
});
</script>
</div><!-- end client-list -->`
$page_idholds expected and correct value at that point? – Rarst♦ Oct 1 '12 at 0:26$page_idvariable holds ID of current page. You should verify that it really does (for example by echoing its value). – Rarst♦ Oct 1 '12 at 0:29<?php var_dump( $page_id ); ?>– Rarst♦ Oct 1 '12 at 0:32