Jquery remove drawn line added via jquery svg library
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.
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);
精彩评论