I am making change to this existing wordpress theme. I am trying to move a div in the footer to body. this is what I wrote using appendchild, but it seems not working.
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();
};
You have a typo, there is no method getElementsById, change it to be getElementById and it will work fine (line 4)