Default a:link and a:visited background-color is transparent and color black. Then a:hover is specified with background to be black and color to be white. This works well.
Here is the problem:
I inserted jquery script which performs a background and color change, in my case to set the background black and color to be white - same as the a:hover. This script is performing the wanted action but the color of the text stays black. Any help?
Here are the codes:
<ul id="subnav">
<li><a href="http://127.0.0.1:4001/wbdemo/pages/abc.php" class=”red” onclick=”selected(this)”><h99>Home<h99/></a></li>
<li><a href="http://127.0.0.1:4001/wbdemo/pages/asd.php"><h99>Home</h99></a></li>
<li><a href="http://127.0.0.1:4001/wbdemo/pages/rtz.php"><h99>Home</h99/></a></li>
<li><a href="#"><h99>Home</h99/></a></li>
<li><a href="#"><h99>Home</h99/></a></li>
</ul>
<script type="text/javascript">
$(document).ready(function(){
$('#subnav a').each(function(index) {
if(this.href.trim() == window.location)
$(this).addClass("selected");
});
});
</script>
ul
{ list-style-type: none;
margin:0;
padding:0;
overflow: hidden;
}
ul a:link, ul a:visited
{ display: block;
width: 240px;
background-color: tranparent;
text-align: right;
text-transform: uppercase;
text-decoration: none;
height: 40px;
color: #000000
}
ul a:hover, .selected
{ background-color: #000000;
color: #ffffff
}