replaceChild with getElementsByClassName() code example
Example: document getelementsbyclassname not getting all elements
//use this instead
document.querySelectorAll(".myclassname");
//use this instead
document.querySelectorAll(".myclassname");