The function below is meant to insert a <polygon></polygon>
into an <svg id = "svg-overlays"></svg>
.
I can see that the element gets successfully inserted when the function is called. However, the polygon is still not visible. If I do the insertion manually within the html document I get the desired polygon.
Unable to determine what the issue is here.
function changeFloorImage(floor) {
var overlays = document.getElementById("svg-overlays");
var polygon = document.createElement("polygon");
polygon.className = "apartment-overlay";
polygon.setAttribute("points", "740,88 972,88 972,353 740,353");
overlays.appendChild(polygon);
};