Hi there! I'm currently working on a menu and I want the clicked item to become active, switching the active state to another item when clicked. However, my current implementation is not working as expected. Any assistance would be greatly appreciated.
HTML
<div id="nav-pPal">
<ul class="nav-Ppal">
<li><a class="btns-nav" id="0" href="#block-intro">01</a></li>
<li><a class="btns-nav" id="1" href="#block-pq-zolfunza">02</a></li>
<li><a class="btns-nav" id="2" href="#block-modulos-zolfunza">03</a></li>
<li><a class="btns-nav" id="3" href="#block-seguridad">04</a></li>
<li><a class="btns-nav" id="4" href="#block-desarrollo">05</a></li>
<li><a class="btns-nav" id="5" href="#block-nuestra-ubic">06</a></li>
<li><a class="btns-nav" id="6" href="#block-noticias">07</a></li>
<li><a class="btns-nav" id="7" href="#block-preguntas">08</a></li>
<li><a class="btns-nav" id="8" href="#block-contacto">09</a></li>
</ul>
</div>
CSS
.nav-Ppal li a {
width: 30px;
height: 22px;
padding-top:8px;
text-align:center;
display:block;
text-decoration:none;
color:#FFF;
cursor:pointer;
background-color: #000;
color: #FFF;
opacity: 1;
-moz-opacity: 0.70;
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha"(Opacity=70);
cursor:pointer;
font-family: 'lucida_sans_unicoderegular', Helvetica, Arial, sans-serif;
font-size:11px;
}
.nav-Ppal li a:hover {
background-color: #f7941e;
color: #FFF;
display:block;
text-decoration:none;
cursor:pointer;
}
.nav-Ppal-active{
background: white;
color: black;
}
jQuery
$(".nav-Ppal li a").on("click", checkTarget);
function checkTarget(){
/*$(".nav-Ppal li a").not(this).removeClass(".nav-Ppal_active");*/
$(".nav-Ppal li a").addClass("nav-Ppal-active");
console.log("click");
}