Is there some innerHTML replacement in SVG/XML?

前端 未结 8 1604
一整个雨季
一整个雨季 2020-11-28 10:28

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

8条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-28 10:42

    With jQuery, you can do it this way:

    Let's suppose your svgString contains your svg image after the replacing operations.

    $(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.

    I hope this helps

提交回复
热议问题