5
I have five links, and initially only the first link is enabled. When this first link is clicked, I want it to auto-disable and enable the next, that is, the second link, and when the second is clicked, to auto-disable and enable the next, and so on.
However, the links that have already been clicked I want to remain disabled until you reach the last link. Below follows a start of what I need:
window.onclick = function(){
document.getElementById('link').onclick = function(){return false};
}
function desabilitar_link(){
document.getElementById('link').innerHTML = "Link desabilitado";
document.getElementById('link').style.color = "grey";
}
<div>
<ul>
<li><a href="http://www.google.com/" target='_blank' id="link" onmouseup="desabilitar_link()"> Link habilitado </a></li>
<li><a href="http://www.google.com/" target='_blank' id="link2" onmouseup="desabilitar_link()"> Link habilitado </a></li>
<li><a href="http://www.google.com/" target='_blank' id="link3" onmouseup="desabilitar_link()"> Link habilitado </a></li>
<li><a href="http://www.google.com/" target='_blank' id="link4" onmouseup="desabilitar_link()"> Link habilitado </a></li>
<li><a href="http://www.google.com/" target='_blank' id="link5" onmouseup="desabilitar_link()"> Link habilitado </a></li>
</ul>
<div>
perfect!! That already solves my Khaosdoctor problem. Valewww for the help!
– Valdiney Pereira
Khaosdoctor, there is one thing. Running in this editor works beauty, but in another editor does not work, I added "jquery" but still does not work. You know what can be?
– Valdiney Pereira
See if there are any errors in Chrome Inspect Element or other browser.
– Diego Souza
Which editor you are using?
– KhaosDoctor
I use 1st Editor jscript pro, however when running it opens by Chrome and even saving the file on the pc still gives the same problem. By embedding this code into my website it worked perfectly.
– Valdiney Pereira
It may be a limitation of the editor itself, try using the Notepad++
– KhaosDoctor