这是我的javascript源代码
let addtobutton = document.getElementById("Todo");
let todocontainer = document.getElementById("to-dos");
let inputfield = document.getElementById("inputfield");
addtobutton.addEventListener('click',function()){
var paragraph = document.createElement('p')
paragraph.innerText = inputfield.value;
todocontainer.appendChild(paragraph)
}
我希望添加项目,然后显示在段落中
1条答案
按热度按时间nvbavucw1#
将代码替换为