2016-10-04 108 views
0

我正在对此存在的wordpress主题进行更改。 我正在尝试在页脚中将div移至正文。 这是我用appendchild写的,但它似乎不工作。使用appendchild将div添加到另一个div

function myFunction() { 
    document.getElementsByClassName("td-post-author-name")[0].setAttribute("id", "block-under-title"); 
    document.getElementsByClassName("td-post-small-box")[0].setAttribute("id", "real-author-name"); 
    var changeName = document.getElementsById("real-author-name"); 
    document.getElementById("block-under-title").appendChild(changeName); 
} 


window.onload = function() { 
    myFunction(); 

}; 
+0

你有一个错字,没有法getElementsById,将其更改为getElementById,它会正常工作(第4行) – sidanmor

回答

2

你有一个错字,没有法getElementsById,将其更改为是的getElementById,它会正常工作(4号线)

+0

谢谢,这是问题!!!!!!!! –

相关问题