提问人:Moein_fadakar 提问时间:9/11/2023 最后编辑:JamiecMoein_fadakar 更新时间:9/11/2023 访问量:34
如何在 Javascript 中添加 1 个以上的输入标签
How can i add more than 1 input tag in Javascript
问:
这是我的 creat 元素标签:
const addinput = document.createElement("input");
这是我添加的btn:
const addbtn = document.querySelector("#plus")
功能是:
addbtn.onclick = function(){
childrendiv.appendChild(addinput);
addinput.style.width = "60vh";
addinput.style.height = "5vh";
addinput.style.margin = "3vh";
addinput.style.fontWeight = "bolder";
addinput.style.fontFamily = "'Lilita One', cursive";
}
如何在 Javascript 中添加多个输入标签?
答:
4赞
Jamiec
9/11/2023
#1
将变量的初始化移动到方法中:addInput
addbtn.onclick = function(){
const addinput = document.createElement("input");
childrendiv.appendChild(addinput);
addinput.style.width = "60vh";
addinput.style.height = "5vh";
addinput.style.margin = "3vh";
addinput.style.fontWeight = "bolder";
addinput.style.fontFamily = "'Lilita One', cursive";
}
评论
createElement
addinput
const addinput = document.createElement("input");