2
I’m trying to send two figures on onclick of HTML, however, the second value is "Undefined", as I can send these two values to the function?
echo "<h3 id='$input' onclick='transfertoinput(this.id, $resp)'>$resp</h3><br>";
In javascript:
function transfertoinput(cl, valor) {
document.getElementById(cl).value = valor;
}
When I call the function, this error appears:
Uncaught Referenceerror: RPG is not defined At Htmlheadingelement.onclick (indexjogo.php:1)
RPG would be the value of the variable '$Resp' and 'cl' is the id of the text input.