Javascript 如何在p标签中获得输出?

Javascript 如何在p标签中获得输出?,javascript,Javascript,为什么这段代码在p标签中没有任何输出? 请解释一下 const inputName = document.getElementById("inputName"); const btnShow = document.getElementById("btnShow"); const pShow = document.getElementById("pShow"); btnShow.addEventListener("click&

为什么这段代码在p标签中没有任何输出? 请解释一下

const inputName = document.getElementById("inputName");
const btnShow = document.getElementById("btnShow");
const pShow = document.getElementById("pShow");

btnShow.addEventListener("click", () => {
  const text = inputName.Value;
  pShow.textContent = text;
});
console.log(inputName, btnShow, pShow);

输入元素具有
属性,而不是
,如下操作:

const inputName=document.getElementById(“inputName”);
const btnShow=document.getElementById(“btnShow”);
const pShow=document.getElementById(“pShow”);
btnShow.addEventListener(“单击”,()=>{
const text=inputName.value;
pShow.textContent=文本;
});

点击我!

这也是我的问题,你找到解决办法了吗?