0
私はこの既存のWordPressテーマに変更を加えています。 私はfooter内のdivをbodyに移動しようとしています。 これは私が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();
};
(ライン4)getElementByIdをするために、それが正常に動作しますそれを変更し、getElementsByIdは、あることに変更方法がありませんgetElementByIdとそれは正常に動作します(行4) – sidanmor