1
Hello! I am doing a dynamic email signature and would like to put some "buttons" and etc. I made one with the function of showing the second number of the company, but when clicking on it the text is played to the bottom line.
How can I solve?
HTML code:
<!DOCTYPE html>
<html>
<head>
<script>
function ocultar(el) {
var display = document.getElementById(el).style.display;
if(display == "none")
document.getElementById(el).style.display = 'block';
else
document.getElementById(el).style.display = 'none';
}
</script>
<script>
function mostrar(id) { Array.from(document.getElementsByClassName("hidden")).forEach(div => div.style.display = "none"); if (document.getElementById(id).style.display == "block"){ document.getElementById(id).style.display = "none"; return; } document.getElementById(id).style.display = "block"; }
</script>
</head>
<body>
<p>Telefone 1: (DDD) XXXX-XXXX Telefone 2:
<a id="minhaDiv2" href="#" onclick="ocultar('minhaDiv2'); mostrar('minhaDiv')"> mostrar</a>
<a id="minhaDiv" class="hidden" style="display: none;">(DDD) XXXX-XXXX</a></p>
<!-- --><p><span style="font-weight: lighter;">Celular: (DDD) 9XXXX-XXXX</span></p>
</body>
</html>