I am trying to to parse a value to id="demo"
onclick function
onclick函数的位置
<p onclick="myFunction()">Value.</p>
值解析到的位置
<span id="demo"> </span>
* Onclick功能脚本
<script>
function myFunction() {
var k = 30;
document.getElementById("demo").value = $k;
}
</script>
I am not able to parse the value to id="demo"
i don't where i am going wrong.
You need use
innerText
instead of.value
for span tag,.value
use for input tag