Here is my HTML that shows the sidebar menu:
<div class="sidebar"> <a class="active" href="<website>/humrec.php">HR Homepage</a> <a href="<website>/hrbenefits.php">Benefits Information</a> <a href="#contact">Scheduling</a> <a href="#about">Links</a> </div> Here is the jQuery code I have, still not working though:
$(document).ready(function(){ $(".sidebar a").click(function ( e ) { e.preventDefault(); $(".sidebar a.active").removeClass("active"); //Remove any "active" class $("a", this).addClass("active"); //Add "active" class to selected tab // $(activeTab).show(); //Fade in the active content }); });
$("a", this)looking for anchors inside of the anchor