-1
I’m trying to get the value of one <a>
send it to a Javascript function, but I don’t know what’s going wrong.
//HTML
<div id="dicaDiv" class="text-center">
<p id="pDica1" style="display: inline;">Dica 1: <span id="mostrarDica1"><a value="dica1" href="javascript:gerarDica(this.value);">mostrar dica</a></span>.</p><br>
<p id="pDica2" style="display: inline;">Dica 2: <span id="MostrarDica2"><a value="dica2" href="javascript:gerarDica(this.value);">mostrar dica</a></span>.</p><br>
</div>
//JS
var dica;
function gerarDica(dica) {
if(dica == "dica1") {
if(randomClasse == 0)
dica = "veículo";
else if(randomClasse == 1)
dica = "animal";
else if(randomClasse == 2)
dica = "cor";
document.getElementById("mostrarDica1").innerHTML = dica;
document.getElementById("botaoDica").style.display = "none";
}
}
The variable randomClasse
is working, the problem is when I try to put in this if(dica == "dica1")
.
still not going, https://jsfiddle.net/7y5ksugj/
– Paulo Henrique Rodrigues Grund
I tested it here and it was http://ws.ri2b.com.br/validcad.com.br/testes/teste.php
– Sérginho