I'm brazilian so, first, sorry for any English error.
My problem is this: I want a menu that clear the previous visited links (turning them to normal again), but keeping the link the current visited link as a:visited in css.
I have found a way to make this. But the problem is it is not working!! This is the code that I have:
< ul id="menuTop">
< li id="menu-link-1">@Html.ActionLink("Home", "Index", null, null, new { id = "link-1-visited" })</li>
< li id="menu-link-2">@Html.ActionLink("Produtos", "Products", null, null, new { id = "link-2-visited" })</li>
< li id="menu-link-3">@Html.ActionLink("Fale Conosco", "ContactUs", null, null, new { id = "link-3-visited" })</li>
< li id="menu-link-4">@Html.ActionLink("Quem Somos", "AboutUs", null, null, new { id = "link-4-visited" })</li>
< /ul>
This is my buttons, and the code to make them "visited" is that:
$(document).ready(function() {
$('#link-1-visited').click(function()
{
$("#menu-link-1").removeAttr("menu-link-1");
$(this).addClass('link-1-visited');
window.alert("test 1 !!");
});
$('#link-2-visited').click(function()
{
$(this).addClass('link-1-visited');
window.alert("test 2 !!");
});
$('#link-3-visited').click(function()
{
$(this).addClass('link-1-visited');
window.alert("test 3 !!");
});
$('#link-4-visited').click(function()
{
$(this).addClass('link-1-visited');
window.alert("test 4 !!");
});
});
The problem is my code in menu-link-1 is not working. I want to remove the ul and li css and add class "link-1-visited" to it.
Do you have any ideas about how can I do that?