Jquery remove drawn line added via jquery svg library

会有一股神秘感。 提交于 2019-12-22 10:28:00

问题


In my application I have a line drawn from one table cell to another cell through jQuery SVG plugin. Following the steps of the blog post http://www.openstudio.fr/Library-for-simple-drawing-with.html I managed to add it. But at the same time I need to remove that line and draw it on another place when mouse hovers. Is there a method to remove the drawn line or should I follow a different methodology to hide it or remove it ? Any help is highly appreciated.


回答1:


According to the documentation the line function returns an svg <line> element, so you should be able to remove it using the standard DOM core method removeChild().

Untested, but hopefully working:

var myline = svg.line(parent, x1, y1, x2, y2, settings);
parent.removeChild(myline);


来源:https://stackoverflow.com/questions/2368492/jquery-remove-drawn-line-added-via-jquery-svg-library

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!