我这片的appendChild不是一个函数错误(JAVASCRIPT)
var inviteSection = document.getElementByClassName("invitedFriends");
var friend = document.createElement("div").class = "friend";
var mail = document.createElement("p").class = "mail";
var span = document.createElement("span").class = "status accepted";
function main() {
inviteSection.appendChild(friend);
friend.appendChild(mail);
friend.appendChild(span);
}
main();
当我运行这个铬控制台,它说“遗漏的类型错误:inviteSection.appendChild不是一个函数”是否有任何修补程序这请帮助我的家伙!
'inviteSection'是一个NodeList而不是dom元素引用 –
'getElementsByClassName'。复数。 –
你可以创建一个小提琴吗? –