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 Answers
+ 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}