0
Display a variable value as a <p> element?
How can I display a variable value as a <p> element? All I need is the Javascript code. Iâve tried: var score = 0; document.getElementById(âtestâ).innerHTML = score; var score = 0; document.getElementById(âtestâ).value = score; âââ This is what the <p> tag inside of the <body> tags looks like: <p id=âtestâ></p>
3 RĂ©ponses
+ 2
It seems to be your parenthese.
Use the up and down ones found when coding.
Use these "" not these ââ
https://code.sololearn.com/WICUzTAzoFb4/?ref=app
+ 1
The Cuber
<body>
...
<p id="test"><p>
...
</body>
var score = "12";
document.getElementById("test").innerHTML = score;
innerHTML expect the text (string) to assign with it
DHANANJAY PATEL
0
you can also use
${score}