Is there an easy way to clear an SVG element's contents?

前端 未结 9 1254
误落风尘
误落风尘 2020-12-29 01:14

In HTML, I can clear a

element with this command:

div.innerHTML = \"\";

Is there an equivalent if I have an

9条回答
  •  忘掉有多难
    2020-12-29 01:41

    I've tried svg.text("") and it seems to work. Clears out all the inner text, keeps the attributes.

提交回复
热议问题