I'm trying to send two values in onclick of HTML , however, the second value becomes "undefined", how can I send these two values to the function? p>
echo "<h3 id='$input' onclick='transfertoinput(this.id, $resp)'>$resp</h3><br>";
No javascript:
function transfertoinput(cl, valor) {
document.getElementById(cl).value = valor;
}
When I run 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.