SVG get text element width

I’m working on some ECMAScript/JavaScript for an SVG file and need to get the width and height of a text element so I can resize a rectangle that surrounds it. In HTML I would be able to use the …

Draw a hollow circle in SVG

I’m not sure how to approach drawing a hollow circle in SVG.

I would like a ring shape filled with a colour and then have a black outline.

The way I thought about doing it was have 2 circles, one …

Create SVG tag with JavaScript

How do I create an SVG element with JavaScript? I tried this:

var svg = document.createElement(‘SVG’);
svg.setAttribute(‘style’, ‘border: 1px solid black’);
svg.setAttribute(‘width’, ‘600’);