JSFiddle - React, Tailwind, and code Playground
by Jeremy Banks
HTML
I add text to the SVG below with JavaScript. It doesn't appear!
<svg id="svg" width="200" height="100"></svg>
CSS
svg {
border: 1px dashed rgba(0,0,0,0.5);
}
JavaScript
var newText = document.createElement("text");
newText.x = 10;
newText.y = 50;
newText.fontSize = 50;
newText.textContent = "Hello, world!";
svg.appendChild( newText );