[英]remove appended svg text jquery
Here is my appended svg text: 这是我所附的svg文本:
$("#textinArea").append(parseSVG('<text x="' + xtext + '" y="' + ytext + '" id="' + '#text_chaise_' + i + '_' + j + '" font-size="55" data-access="'+access+'" font-family="Verdana" alignment-baseline="middle" text-anchor="middle" fill="Black">O</text>'));
After that i wanted to delete this text and clear it from the image/rectangle. 之后,我想删除此文本并从图像/矩形中清除它。
I tried many solutions like : 我尝试了许多解决方案,例如:
- $("#text_chaise_" + i + "_" + j).empty();
- $("#textinArea").append(parseSVG('<text x="' + xtext + '" y="' + ytext + '" id="' + '#text_chaise_' + i + '_' + j + '" font-size="55" font-family="Verdana" alignment-baseline="middle" text-anchor="middle" fill="Black"></text>'));
- $("#textinArea").closest("text_chaise_" + i + "_" + j).empty();
and i've got no solution to delete this . 而且我没有解决办法删除它。
whene i use : $("#textinArea").empty()
it deletes all the texts that are appended to textinArea
and its not what I want. 当我使用: $("#textinArea").empty()
它将删除所有附加到textinArea
的文本,而不是我想要的。
Maybe you could try it as a by-reference object? 也许您可以尝试将其作为辅助对象?
var myText = parseSVG('<text x="' + xtext + '" y="' + ytext + '" id="' + '#text_chaise_' + i + '_' + j + '" font-size="55" data-access="'+access+'" font-family="Verdana" alignment-baseline="middle" text-anchor="middle" fill="Black">O</text>');
$("#textinArea").append(myText);
// Delete it by reference
delete myText;
A delete
will delete any dom elements, and maybe this will also work on svg elements. delete
将删除所有dom元素,也许这也将对svg元素起作用。 But I'm not sure. 但是我不确定。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.