开发者

Jquery remove drawn line added via jquery svg library

开发者 https://www.devze.com 2022-12-21 15:03 出处:网络
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

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消