In HTML I can build a simple templating system by providing a template in form of a string, replace some parts of it and then assign it using innerHTML to some
innerHTML
With jQuery, you can do it this way:
Let's suppose your svgString contains your svg image after the replacing operations.
svgString
$(svgString)[0] to create a svg tag corresponding to your string. Then you can append this element where you want in the dom to draw the image.
$(svgString)[0]
I hope this helps