2
I need to perform two functions with onClick, but I’m not succeeding, could someone help me? I want to hide the father div "introductionAds" and show the div "showID"
function ocultar(ocultarID){
document.getElementById(ocultarID).style.display='none';
}
function mostrar(mostrarID){
document.getElementById(mostrarID).style.display='block';
}
.disabled {
text-decoration: none;
color: gray;
cursor: default;
}
<div id='introductionAds'>
<ul>
<li><a href="" target='_blank' class='' id="link1"> Link habilitado </a></li>
<li><a href="" target='_blank' class='disabled' id="link2"> Link habilitado </a></li>
<li><a href="" target='_blank' class='disabled' id="link3"> Link habilitado </a></li>
<li><a href="" target='_blank' class='disabled' id="link4"> Link habilitado </a></li>
<li><a href="" target='_blank' class='disabled' id="link5" onclick="this.onclick=function(){mostrar('mostrarID');ocultar('introductionAds');}"> Link habilitado </a></li>
</ul>
<div>
<div id='mostrarID' style='display:none;'>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</div>
William this was my first attempt and as incredible as it seems it doesn’t work, but realize that I want to run the function on a link and not on a button. For you to have an idea try to put my script in an editor and run it for you see, not funfiona like this, at least should.
– Valdiney Pereira