As noted by squeamish ossifrage in the comments:
"ttp://www.w3.org/2000/svg" is not a valid namespace. You missed out the h at the beginning. Also, try appending the text node after the circles and rectangle, otherwise it will probably be covered by them.
const holder = document.createElement("div");
const svg1 = document.createElementNS("http://www.w3.org/2000/svg", "svg");
svg1.setAttribute("width", "400");
svg1.setAttribute("height", "50");
holder.id = "getShitDoneID";
console.log(holder);
// Left Circle
const circ1 = document.createElementNS("http://www.w3.org/2000/svg", "circle");
circ1.setAttribute("fill", "#F3EAE8");
circ1.setAttribute("cx", 25);
circ1.setAttribute("cy", 25);
circ1.setAttribute("r", 25);
// Right Circle
const circ2 = document.createElementNS("http://www.w3.org/2000/svg", "circle");
circ2.setAttribute("fill", "#F3EAE8");
circ2.setAttribute("cx", 375);
circ2.setAttribute("cy", 25);
circ2.setAttribute("r", 25);
// Center Rectangle
const txtBox = document.createElementNS("http://www.w3.org/2000/svg", "rect");
txtBox.setAttribute("x", 25);
txtBox.setAttribute("y", 0);
txtBox.setAttribute("height", 50);
txtBox.setAttribute("width", 350);
txtBox.setAttribute("fill", "#F3EAE8");
// Text that contains Task
const text = document.createElementNS("http://www.w3.org/2000/svg", "text");
text.setAttribute("x", 25);
text.setAttribute("y", 25);
text.setAttribute("textLength", "6em");
text.setAttribute("fill", "black");
let innerText = document.createTextNode(
"This is the text!"
);
text.appendChild(innerText);
svg1.appendChild(circ1);
svg1.appendChild(txtBox);
svg1.appendChild(circ2);
svg1.appendChild(text);
holder.appendChild(svg1);
console.log(document.querySelector("body"));
document.querySelector("body").appendChild(holder);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
</head>
<body>
<div id="main"></div>
<script src="script.js"></script>
</body>
</html>
I have a scrollable list and I would like to know when I've reached the end. Example: HTML: <ol> <li>a</li> <li>b</li> .... </ol> CSS: ol { ...
I have a scrollable list and I would like to know when I've reached the end. Example: HTML: <ol> <li>a</li> <li>b</li> .... </ol> CSS: ol { ...
I have a little script at the bottom of the webpage with the following: <script language="Javascript"> var d = document.lastModified; var n = d.toLocaleString(); document.write("...
I have a little script at the bottom of the webpage with the following: <script language="Javascript"> var d = document.lastModified; var n = d.toLocaleString(); document.write("...
I'm new to PHP and very lost. I'm working with HTML5, CSS3, jQuery and Bootstrap 4. I have a total of 4 HTML pages on my website. In the first page there are 4 squares with text (let's say A, B, C ...
I'm new to PHP and very lost. I'm working with HTML5, CSS3, jQuery and Bootstrap 4. I have a total of 4 HTML pages on my website. In the first page there are 4 squares with text (let's say A, B, C ...
I want to push all the item-data into one array. However, when I try, it just makes an array for every item. async function final() { const response = await fetch('/api'); const data = await ...
I want to push all the item-data into one array. However, when I try, it just makes an array for every item. async function final() { const response = await fetch('/api'); const data = await ...